
#!/bin/sh
if [ ! "$SAS_ODFDIR" ]; then
echo ""
echo "Please set the SAS_ODFDIR environment variable to point at the directory"
echo "containing the ODF files for this observation."
echo ""
exit 1
fi
# # [INFO] [2024-11-30T23:54:49] Module name: VerifyODF
# # [INFO] [2024-11-30T23:54:49] Instrument: all
# # [INFO] [2024-11-30T23:54:49] Stream no.: 0001
# # [INFO] [2024-11-30T23:54:49] Module version number: 1.18
# # [INFO] [2024-11-30T23:54:49] Version of odfingest used was 3.33.1
# # [INFO] [2024-11-30T23:54:49] Module name: MakeCIF
# # [INFO] [2024-11-30T23:54:49] Instrument: all
# # [INFO] [2024-11-30T23:54:49] Stream no.: 0001
# # [INFO] [2024-11-30T23:54:49] Module version number: 1.23
# # [INFO] [2024-11-30T23:54:49] Observation start defined as >2005-05-17T10:51:55.000<
# # [INFO] [2024-11-30T23:54:49] Processing date defined as >2024-12-01T00:54:49<
# [COMMAND] [2024-11-30T23:54:49]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:54:49]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:54:49] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:54:49]
cifbuild analysisdate=2024-12-01T00:54:49 calindexset=product/P0202360201OBX000CALIND0000.FIT fullpath=no \
observationdate=2005-05-17T10:51:55.000 withccfpath=no -w 10
# # [OUTPUT] [2024-11-30T23:55:18]
# # [INFO] [2024-11-30T23:55:18] Task Run Time cifbuild 29.0090401172638s
#
# [COMMAND] [2024-11-30T23:55:18]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:18]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:18] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:18]
addattribute attributecomment="\"Telescope (mission) name\" \"Observation identifier\" \"Name of PI\" \"Observation mode (pointing \
or slew)\" \"Name of observed object\" \"Date observations were made\" \"RA of instrument pointing (degrees)\" \"DEC of instrument \
pointing\" \"Date observations ended\"" attributename="TELESCOP OBS_ID OBSERVER OBS_MODE OBJECT DATE-OBS RA_PNT DEC_PNT DATE-END" \
attributetype="string string string string string string real real string" realvalue="347.0814585 -15.4099444" \
set=product/P0202360201OBX000CALIND0000.FIT stringvalue="\"XMM\" \"0202360201\" \"Dr ANTONIO MAGGIO\" \"POINTED\" \"HK AQR\" \
\"2005-05-17T10:51:55.000\" \"2005-05-17T10:52:17.000\"" -w 10
# # [OUTPUT] [2024-11-30T23:55:18]
# # [INFO] [2024-11-30T23:55:18] Task Run Time addattribute 0.0445749759674072s
#
# [COMMAND] [2024-11-30T23:55:18]
cp /scratch/226771.1.all.q/xmm/ppsprod/229913/product/P0202360201OBX000CALIND0000.FIT \
/scratch/226771.1.all.q/xmm/ppsprod/229913/intermediate/ccf.cif
# # [INFO] [2024-11-30T23:55:18] System RV 0
# # [INFO] [2024-11-30T23:55:18] Module name: GlobalHK
# # [INFO] [2024-11-30T23:55:18] Instrument: all
# # [INFO] [2024-11-30T23:55:18] Stream no.: 0001
# # [INFO] [2024-11-30T23:55:18] Module version number: 1.81
# [COMMAND] [2024-11-30T23:55:18]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:18]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:18] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:18]
preqgti preqgtifile=intermediate/GlobalHK-all-1-Attitude_GTI-X00000000000000.fits -w 10
# # [OUTPUT] [2024-11-30T23:55:23] ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714203.184\
#     which is more than 20 s outside the period for which the attitude is known (closest time is -31 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714203.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -31 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714204.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -30 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714204.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -30 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714205.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -29 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714205.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -29 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714206.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -28 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714206.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -28 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714207.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -27 s away).
# ** preqgti::atthkgen: warning (NoAttitude), The attitude was requested for time 232714207.184 which is more than 20 s outside the\
#     period for which the attitude is known (closest time is -27 s away).
# ** preqgti: warning (SummaryOfWarnings), 
# warning NoAttitude silently occurred 251146 times 
# # [INFO] [2024-11-30T23:55:23] Task Run Time preqgti 4.49328804016113s
#
# [COMMAND] [2024-11-30T23:55:23]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:23]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:23] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:23]
atthkgen atthkset=product/P0202360201OBX000ATTTSR0000.FIT preqgtifile=intermediate/GlobalHK-all-1-Attitude_GTI-X00000000000000.fits \
timestep=1 withpreqgti=no -w 10
# # [OUTPUT] [2024-11-30T23:55:23]
# # [INFO] [2024-11-30T23:55:23] Task Run Time atthkgen 0.131350994110107s
#
# [COMMAND] [2024-11-30T23:55:23]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:23]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:23] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:23]
orbit outfile=product/P0202360201OBX000ORBTSR0000.FIT timestep=1 useobsid=yes -w 10
# # [OUTPUT] [2024-11-30T23:55:23] orbit:- Output FITS Orbit timeseries: product/P0202360201OBX000ORBTSR0000.FIT
# orbit:- Binsize (timestep) of output): 1
# orbit:- Use OBSID data or whole orbit? T 
# # [INFO] [2024-11-30T23:55:23] Task Run Time orbit 0.126116037368774s
#
# [COMMAND] [2024-11-30T23:55:23]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:23]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:23] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:23]
radmonfix output=product/P0202360201OBX000RADMON0000.FIT radmonlist="odf/0996_0202360201_RMX00100ECX.FIT \
odf/0996_0202360201_RMX00200ECX.FIT" withoutputfile=yes -w 10
# # [OUTPUT] [2024-11-30T23:55:23] ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947505.9 which\
#     is outside the time correlation data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted\
#     with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947509.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947513.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947609.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947645.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947673.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947701.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947709.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947721.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# ** radmonfix: warning (Extrapolation), Evaluating OBT-MET fit polynomial at x=153947725.9 which is outside the time correlation\
#     data abscissa range [153948471.1, 153953419.6] - result of extrapolation might be afflicted with large numerical uncertainty.
# radmonfix:- Adding 1536 counts rows from row 145
# radmonfix:- Setting DATE-END...
# ** radmonfix: warning (SummaryOfWarnings), 
# warning Extrapolation silently occurred 412 times 
# # [INFO] [2024-11-30T23:55:23] Task Run Time radmonfix 0.148910999298096s
#
# [COMMAND] [2024-11-30T23:55:23]
cp /lhome/jperea/ppsdev/pcms3/src/pipeline/etc/EPICModes.fits \
/scratch/226771.1.all.q/xmm/ppsprod/229913/intermediate/GlobalHK-all-1-Observing_modes_Pileup_and_OoT_data-X00000000000000.fits
# # [INFO] [2024-11-30T23:55:23] System RV 0
# # [INFO] [2024-11-30T23:55:23] Copied EPIC Observing modes table, Pileup data and OoT data table in place
# [COMMAND] [2024-11-30T23:55:23]
cp /lhome/jperea/ppsdev/pcms3/src/pipeline/etc/ecfs.fits \
/scratch/226771.1.all.q/xmm/ppsprod/229913/intermediate/GlobalHK-all-1-Energy_Conversion_Factors-X00000000000000.fits
# # [INFO] [2024-11-30T23:55:23] System RV 0
# [COMMAND] [2024-11-30T23:55:23]
cp /lhome/jperea/ppsdev/pcms3/src/pipeline/etc/ecfgrid.fits.gz \
/scratch/226771.1.all.q/xmm/ppsprod/229913/intermediate/GlobalHK-all-1-Energy_Conversion_Factors_Grid-X00000000000000.fits
# # [INFO] [2024-11-30T23:55:23] System RV 0
# [COMMAND] [2024-11-30T23:55:23]
cp /lhome/jperea/ppsdev/pcms3/src/pipeline/etc/fluxgrid.fits.gz \
/scratch/226771.1.all.q/xmm/ppsprod/229913/intermediate/GlobalHK-all-1-Flux_Grid-X00000000000000.fits
# # [INFO] [2024-11-30T23:55:23] System RV 0
# # [INFO] [2024-11-30T23:55:23] Module name: ExpChooser
# # [INFO] [2024-11-30T23:55:23] Instrument: om
# # [INFO] [2024-11-30T23:55:23] Stream no.: 0001
# # [INFO] [2024-11-30T23:55:23] Module version number: 1.38
# # [INFO] [2024-11-30T23:55:23] Checking exposure S400 for processability
# # [INFO] [2024-11-30T23:55:23] Filter: Blocked
# # [INFO] [2024-11-30T23:55:23] Instrument mode: IntensifierCharacteristics
# # [INFO] [2024-11-30T23:55:23] Exposure duration: 22
# # [INFO] [2024-11-30T23:55:23] Exposure ignored due to invalid or unsupported filter
# # [INFO] [2024-11-30T23:55:23] Module name: StampKeywords
# # [INFO] [2024-11-30T23:55:23] Instrument: all
# # [INFO] [2024-11-30T23:55:23] Stream no.: 0001
# # [INFO] [2024-11-30T23:55:23] Module version number: 2.09
# # [INFO] [2024-11-30T23:55:23] Getting ODS version from file\
#     /scratch/226771.1.all.q/xmm/ppsprod/229913/odf/0996_0202360201_SCX00000TCS.FIT
# [COMMAND] [2024-11-30T23:55:23]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:23]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:23] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:23]
addattribute attributecomment="\"Pipeline sequence\" \"Satellite Revolution Number\" \"Processing date\" \"Processing revision\" \
\"PPS configuration\" \"SAS version used in pipeline processing\" \"ODS version\" \"Origin of FITS file\" \"ODF_VERSION\" \"Contents \
of file\"" attributename="SEQ_ID REVOLUT PROCDATE PROCREV PPSVERS SASVERS ODSVER ORIGIN ODFVER CONTENT" attributetype="string string \
string string string string string string string string" booleanvalue="" realvalue="" set=product/P0202360201OBX000CALIND0000.FIT \
stringvalue="\"229913\" \"0996\" \"2024-12-01T00:54:49\" \"1\" \"21.51_20241115_1113\" \"xmmsas_20241108_1150-21.0.0\" \"14.1.0\" \
\"XMM-Newton/SOC\" \"003\" \"CALIBRATION INDEX FILE\"" -w 10
# # [OUTPUT] [2024-11-30T23:55:23]
# # [INFO] [2024-11-30T23:55:23] Task Run Time addattribute 0.0384929180145264s
#
# [COMMAND] [2024-11-30T23:55:23]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:23]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:23] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:23]
addattribute attributecomment="\"Pipeline sequence\" \"Satellite Revolution Number\" \"Processing date\" \"Processing revision\" \
\"PPS configuration\" \"SAS version used in pipeline processing\" \"ODS version\" \"Origin of FITS file\" \"ODF_VERSION\" \"Contents \
of file\"" attributename="SEQ_ID REVOLUT PROCDATE PROCREV PPSVERS SASVERS ODSVER ORIGIN ODFVER CONTENT" attributetype="string string \
string string string string string string string string" booleanvalue="" realvalue="" set=product/P0202360201OBX000ATTTSR0000.FIT \
stringvalue="\"229913\" \"0996\" \"2024-12-01T00:54:49\" \"1\" \"21.51_20241115_1113\" \"xmmsas_20241108_1150-21.0.0\" \"14.1.0\" \
\"XMM-Newton/SOC\" \"003\" \"ATTITUDE TIME SERIES\"" -w 10
# # [OUTPUT] [2024-11-30T23:55:23]
# # [INFO] [2024-11-30T23:55:23] Task Run Time addattribute 0.0485789775848389s
#
# [COMMAND] [2024-11-30T23:55:23]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:23]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:23] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:23]
addattribute attributecomment="\"Pipeline sequence\" \"Satellite Revolution Number\" \"Processing date\" \"Processing revision\" \
\"PPS configuration\" \"SAS version used in pipeline processing\" \"ODS version\" \"Origin of FITS file\" \"ODF_VERSION\" \"Contents \
of file\"" attributename="SEQ_ID REVOLUT PROCDATE PROCREV PPSVERS SASVERS ODSVER ORIGIN ODFVER CONTENT" attributetype="string string \
string string string string string string string string" booleanvalue="" realvalue="" set=product/P0202360201OBX000ORBTSR0000.FIT \
stringvalue="\"229913\" \"0996\" \"2024-12-01T00:54:49\" \"1\" \"21.51_20241115_1113\" \"xmmsas_20241108_1150-21.0.0\" \"14.1.0\" \
\"XMM-Newton/SOC\" \"003\" \"SPACECRAFT ORBIT\"" -w 10
# # [OUTPUT] [2024-11-30T23:55:23]
# # [INFO] [2024-11-30T23:55:23] Task Run Time addattribute 0.0645360946655273s
#
# [COMMAND] [2024-11-30T23:55:23]
export SAS_MEMORY_MODEL=high
# [COMMAND] [2024-11-30T23:55:23]
export SAS_RAND_SEED=0202360201
# # [INFO] [2024-11-30T23:55:23] ## DEBUG ModuleResources: SAS_RAND_SEED set: 0202360201
# [COMMAND] [2024-11-30T23:55:23]
addattribute attributecomment="\"Pipeline sequence\" \"Satellite Revolution Number\" \"Processing date\" \"Processing revision\" \
\"PPS configuration\" \"SAS version used in pipeline processing\" \"ODS version\" \"Origin of FITS file\" \"ODF_VERSION\" \"Contents \
of file\"" attributename="SEQ_ID REVOLUT PROCDATE PROCREV PPSVERS SASVERS ODSVER ORIGIN ODFVER CONTENT" attributetype="string string \
string string string string string string string string" booleanvalue="" realvalue="" set=product/P0202360201OBX000RADMON0000.FIT \
stringvalue="\"229913\" \"0996\" \"2024-12-01T00:54:49\" \"1\" \"21.51_20241115_1113\" \"xmmsas_20241108_1150-21.0.0\" \"14.1.0\" \
\"XMM-Newton/SOC\" \"003\" \"RADMON RATE\"" -w 10
# # [OUTPUT] [2024-11-30T23:55:23]
# # [INFO] [2024-11-30T23:55:23] Task Run Time addattribute 0.0424370765686035s
#
# [COMMAND] [2024-11-30T23:55:23]
gzip --rsyncable -f intermediate/GlobalHK-all-1-Attitude_GTI-X00000000000000.fits
# # [INFO] [2024-11-30T23:55:23] System RV 0
# [COMMAND] [2024-11-30T23:55:23]
gzip --rsyncable -f intermediate/GlobalHK-all-1-Observing_modes_Pileup_and_OoT_data-X00000000000000.fits
# # [INFO] [2024-11-30T23:55:23] System RV 0
# [COMMAND] [2024-11-30T23:55:23]
gzip --rsyncable -f intermediate/GlobalHK-all-1-Energy_Conversion_Factors-X00000000000000.fits
# # [INFO] [2024-11-30T23:55:23] System RV 0
