njcuk9999 / apero-drs

A PipelinE to Reduce Observations - The DRS for SPIRou (CFHT)
MIT License
12 stars 0 forks source link

Errors after the reduction of all calibrations: apero_thermal_spirou (0.7.286) #712

Open larnoldgithub opened 1 year ago

larnoldgithub commented 1 year ago

Very few errors. I got two errors with apero_thermal_spirou.py 22BQ11-Nov12 and 22BQ13-Dec01:

02:31:13.618- |PROC| 02:31:13.633-@!|PROC| W[40-503-00019]: Error found for ID='4502' 02:31:13.643-@!|PROC| apero_thermal_spirou.py 22BQ11-Nov12 2812091d_pp.fits 2812092d_pp.fits 2812228d_pp.fits 2812229d_pp.fits --crunfile=run_FullCalib_only.ini --program=THERM_T[04502] --recipe_kind=calib-night-T --shortname=THERM_T --parallel=True 02:31:13.658- |PROC| 02:31:13.668- |PROC| E[01-001-00012]: Read Error: File '161C3D015B_pp_e2dsff_AB.fits' could not be found in directory '/data/spirou4/apero-data/offline/reduced/22BQ11-Nov12'. function = io.drs_fits.py.readfits() 02:31:13.709- |PROC| 02:31:13.725- |PROC| 02:31:13.742- |PROC| 02:31:13.758- |PROC| 02:31:13.770- |PROC| 02:31:13.791-@!|PROC| W[40-503-00019]: Error found for ID='4512' 02:31:13.818-@!|PROC| apero_thermal_spirou.py 22BQ13-Dec01 2814550d_pp.fits 2814551d_pp.fits 2814689d_pp.fits 2814690d_pp.fits --crunfile=run_FullCalib_only.ini --program=THERM_T[04512] --recipe_kind=calib-night-T --shortname=THERM_T --parallel=True 02:31:13.838- |PROC| 02:31:13.868- |PROC| E[01-001-00012]: Read Error: File 'AC7554BC8C_pp_e2dsff_AB.fits' could not be found in directory '/data/spirou4/apero-data/offline/reduced/22BQ13-Dec01'. function = io.drs_fits.py.readfits() 02:31:13.991- |PROC| 02:31:14.012- |PROC| 02:31:14.030- |PROC|

I just re-played the commands apero_thermal_spirou.py 22BQ11-Nov12 2812091d_pp.fits 2812092d_pp.fits 2812228d_pp.fits 2812229d_pp.fits --crunfile=run_FullCalib_only.ini --program=THERM_T[04502] --recipe_kind=calib-night-T --shortname=THERM_T --parallel=True

and

apero_thermal_spirou.py 22BQ13-Dec01 2814550d_pp.fits 2814551d_pp.fits 2814689d_pp.fits 2814690d_pp.fits --crunfile=run_FullCalib_only.ini --program=THERM_T[04512] --recipe_kind=calib-night-T --shortname=THERM_T --parallel=True

and it worked, no error, missing file isn't missing anymore.

2 questions: 1/ what happened ? RAM doesn't seem to have been an issue, always << 100Gb allocated (around 50Gb). 2/ Do I need to reprocess everything for the calibrations of those 2 nights to be sure everything is ok ?

Thanks

njcuk9999 commented 1 year ago

This one I'm not sure about. What is the DPRTYPE for 161C3D015B_pp_e2dsff_AB.fits and AC7554BC8C_pp_e2dsff_AB.fits?

Looks like the extraction code broke the first time and didn't produce the e2ds files (but then you should have an error relating to this), even weird that after running it again it worked.

larnoldgithub commented 1 year ago

Both 161C3D015B_pp_e2dsff_AB.fits and AC7554BC8C_pp_e2dsff_AB.fits are DPRTYPE DARK_DARK_TEL

larnoldgithub commented 1 year ago

full log of one on the errors:

Why does the routine build AC7554BC8C_pp.fits and then immediately try to read AC7554BC8C_pp_e2dsff_AB.fits ?

02:03:45.244- |THERM_T[04512]| 02:03:45.306- |THERM_T[04512]| 02:03:45.342- |THERM_T[04512]| SPIROU @PID-00016932746230568120-SXDG (V0.7.286) 02:03:45.380- |THERM_T[04512]| py3.9.16 git:v0.7.286-stable-test 02:03:45.401- |THERM_T[04512]| 02:03:45.416- |THERM_T[04512]| Group: APEROG-PID-00016931884096755940-1EJZ_apero_processing_group 02:03:45.436- |THERM_T[04512]| *** 02:03:45.469-|THERM_T[04512]|I[40-001-00006]: DRS Setup: 02:03:45.501-|THERM_T[04512]|I[ 02:03:45.509-|THERM_T[04512]| DRS_ROOT: /apero/apero-drs/apero]: 02:03:45.524-|THERM_T[04512]| DRS_ROOT: /apero/apero-drs/apero 02:03:45.553-|THERM_T[04512]| DRS_DATA_RAW: /data/spirou4/arlinks 02:03:45.598-|THERM_T[04512]| DRS_DATA_REDUC: /data/spirou4/apero-data/offline/reduced 02:03:45.630-|THERM_T[04512]| DRS_DATA_WORKING: /data/spirou4/apero-data/offline/tmp 02:03:45.654-|THERM_T[04512]| DRS_CALIB_DB: /data/spirou4/apero-data/offline/calibDB 02:03:45.685-|THERM_T[04512]| DRS_TELLU_DB: /data/spirou4/apero-data/offline/telluDB 02:03:45.710-|THERM_T[04512]| DRS_DATA_ASSETS: /data/spirou4/apero-data/offline/assets 02:03:45.721-|THERM_T[04512]| DRS_DATA_MSG: /data/spirou4/apero-data/offline/msg 02:03:45.742-|THERM_T[04512]| DRS_DATA_RUN: /data/spirou4/apero-data/offline/runs 02:03:45.760-|THERM_T[04512]| DRS_DATA_PLOT: /data/spirou4/apero-data/offline/plot 02:03:45.784-|THERM_T[04512]| DRS_CONFIG: /apero/config/offline/user_config.ini 02:03:45.801-|THERM_T[04512]| DRS_CONFIG: /apero/config/offline/user_constants.ini 02:03:45.866-|THERM_T[04512]| DRS_CONFIG: apero.constants.default.default_config 02:03:45.916-|THERM_T[04512]| DRS_CONFIG: apero.constants.default.default_keywords 02:03:45.924-|THERM_T[04512]| DRS_CONFIG: config.instruments.spirou.default_config.py 02:03:45.941-|THERM_T[04512]| DRS_CONFIG: config.instruments.spirou.default_keywords.py 02:03:45.983-|THERM_T[04512]| DRS_CONFIG: core.instruments.default.default_constants.py 02:03:46.024-|THERM_T[04512]| DRS_CONFIG: core.instruments.spirou.default_constants.py 02:03:46.066-|THERM_T[04512]| DATABASE: MYSQL 02:03:46.108-|THERM_T[04512]| DATABASE-calib: aperooffline@localhost:calib_offline_db 02:03:46.150-|THERM_T[04512]| DATABASE-tellu: aperooffline@localhost:tellu_offline_db 02:03:46.200-|THERM_T[04512]| DATABASE-findex: aperooffline@localhost:findex_offline_db 02:03:46.243-|THERM_T[04512]| DATABASE-log: aperooffline@localhost:log_offline_db 02:03:46.285-|THERM_T[04512]| DATABASE-astrom: aperooffline@localhost:astrom_offline_db 02:03:46.326-|THERM_T[04512]| DATABASE-lang: aperooffline@localhost:lang_offline_db 02:03:46.377-|THERM_T[04512]| DATABASE-reject: aperooffline@localhost:reject_offline_db 02:03:46.419-|THERM_T[04512]| PRINT_LEVEL: all 02:03:46.468-|THERM_T[04512]| LOG_LEVEL: all 02:03:46.514-|THERM_T[04512]| DRS_PLOT: 0 02:03:46.569- |THERM_T[04512]| * 02:03:46.647- |THERM_T[04512]|A[40-001-00010]: System information 02:03:46.690- |THERM_T[04512]| 02:03:46.732- |THERM_T[04512]| Python version = '3.9.16' 02:03:46.774- |THERM_T[04512]| Distribution date = 'main, Jan 11 2023, 16:05:54' 02:03:46.821- |THERM_T[04512]| Other information = 'GCC 11.2.0' 02:03:46.863- |THERM_T[04512]| Path = '/conda/miniconda3/envs/apero-env/bin/python' 02:03:46.905- |THERM_T[04512]| Platform = 'linux' 02:03:46.946- |THERM_T[04512]| Currently installed python modules: 02:03:46.980- |THERM_T[04512]| astropy: 5.3 (req: 5.3) 02:03:47.039- |THERM_T[04512]| astroquery: 0.4.6 (req: 0.4.6) 02:03:47.064- |THERM_T[04512]| barycorrpy: 0.4.4 (req: 0.4.4) 02:03:47.081- |THERM_T[04512]| duckdb: 0.8.0 (req: 0.8) 02:03:47.098- |THERM_T[04512]| matplotlib: 3.7.1 (req: 3.7.1) 02:03:47.115- |THERM_T[04512]| numba: 0.57.0 (req: 0.57.0) 02:03:47.124- |THERM_T[04512]| numexpr: 2.8.4 (req: 2.8.4) 02:03:47.148- |THERM_T[04512]| numpy: 1.24.3 (req: 1.24.3) 02:03:47.191- |THERM_T[04512]| pandas: 2.0.1 (req: 2.0.1) 02:03:47.241- |THERM_T[04512]| pandastable: 0.13.1 (req: 0.13.1) 02:03:47.291- |THERM_T[04512]| psutil: 5.9.4 (req: 5.9.4) 02:03:47.341- |THERM_T[04512]| scipy: 1.9.2 (req: 1.9.2) 02:03:47.392- |THERM_T[04512]| tqdm: 4.65.0 (req: 4.65.0) 02:03:47.442- |THERM_T[04512]| yagmail: 0.15.293 (req: 0.15.293) 02:03:47.492- |THERM_T[04512]| Raw arguments used: 02:03:47.533- |THERM_T[04512]| Arg 1 = 'apero_processing.py' 02:03:47.575- |THERM_T[04512]| 02:03:47.615-|THERM_T[04512]|I[40-001-00017]: Arguments used: 02:03:47.673-|THERM_T[04512]| 02:03:47.709-|THERM_T[04512]| --OBS_DIR: /data/spirou4/apero-data/offline/tmp/22BQ13-Dec01 02:03:47.759-|THERM_T[04512]| --FILES[0]: [DARK_DARK_TEL] 2814550d_pp.fits 02:03:47.816-|THERM_T[04512]| --FILES[1]: [DARK_DARK_TEL] 2814551d_pp.fits 02:03:47.880-|THERM_T[04512]| --FILES[2]: [DARK_DARK_TEL] 2814689d_pp.fits 02:03:47.933-|THERM_T[04512]| --FILES[3]: [DARK_DARK_TEL] 2814690d_pp.fits 02:03:47.983-|THERM_T[04512]| --DATABASE: True 02:03:48.033-|THERM_T[04512]| --BADCORR: True 02:03:48.083-|THERM_T[04512]| --BACKSUB: True 02:03:48.127-|THERM_T[04512]| --COMBINE: True 02:03:48.168-|THERM_T[04512]| --DARKCORR: True 02:03:48.219-|THERM_T[04512]| --FIBER: ALL 02:03:48.269-|THERM_T[04512]| --FLIPIMAGE: both 02:03:48.302-|THERM_T[04512]| --FLUXUNITS: e- 02:03:48.350-|THERM_T[04512]| --PLOT: 0 02:03:48.388-|THERM_T[04512]| --RESIZE: True 02:03:48.420-|THERM_T[04512]| --FORCEEXT: False 02:03:48.473-|THERM_T[04512]| --DEBUG: None 02:03:48.490-|THERM_T[04512]| --PROGRAM: THERM_T[04512] 02:03:48.514-|THERM_T[04512]| --RECIPE_KIND: calib-night-T 02:03:48.534-|THERM_T[04512]| --PARALLEL: True 02:03:48.583-|THERM_T[04512]| --SHORTNAME: THERM_T 02:03:48.650-|THERM_T[04512]| --IDEBUG: None 02:03:48.692-|THERM_T[04512]| --REF: None 02:03:48.748-|THERM_T[04512]| --CRUNFILE: run_FullCalib_only.ini 02:03:48.806-|THERM_T[04512]| --NOSAVE: False 02:03:48.848-|THERM_T[04512]| --FORCE_INDIR: None 02:03:48.885-|THERM_T[04512]| --FORCE_OUTDIR: None 02:03:48.971- |THERM_T[04512]| ** 02:03:49.152- |THERM_T[04512]|A[40-005-10004]: Checking input qc for: files 02:03:49.242- |THERM_T[04512]|A[40-005-10005]: All input files files passed QC 02:04:17.798- |THERM_T[04512]|A[40-999-00004]: Combining files. Math = 'median' 02:04:18.555- |THERM_T[04512]|A[40-001-00025]: Writing combined file: /data/spirou4/apero-data/offline/reduced/22BQ13-Dec01/AC7554BC8C_pp.fits 02:04:20.178- |THERM_T[04512]| 02:04:20.200- |THERM_T[04512]|A[40-001-00020]: Processing file 1 of 1 02:04:20.225- |THERM_T[04512]| ***** 02:07:55.295- |THERM_T[04512]|A[40-016-00021]: Found and reading extracted file /data/spirou4/apero-data/offline/reduced/22BQ13-Dec01/AC7554BC8C_pp_e2dsff_AB.fits 02:07:55.358-!!|THERM_T[04512]|E[01-001-00012]: Read Error: File 'AC7554BC8C_pp_e2dsff_AB.fits' could not be found in directory '/data/spirou4/apero-data/offline/reduce d/22BQ13-Dec01'. 02:07:55.381-!!|THERM_T[04512]| function = io.drs_fits.py.readfits() 02:07:55.424-!!|THERM_T[04512]|Traceback (most recent call last): 02:07:55.453-!!|THERM_T[04512]| File "/apero/apero-drs/apero/core/utils/drs_startup.py", line 432, in run 02:07:55.471-!!|THERM_T[04512]| llmain = func(recipe, params) 02:07:55.503-!!|THERM_T[04512]| File "/apero/apero-drs/apero/recipes/spirou/apero_thermal_spirou.py", line 163, in main 02:07:55.544-!!|THERM_T[04512]| thermal_files = extractother.extract_thermal_files(*eargs) 02:07:55.786-!!|THERM_T[04512]| File "/apero/apero-drs/apero/science/extract/other.py", line 80, in extract_thermal_files 02:07:56.134-!!|THERM_T[04512]| thermal_outputs = extract_files(params, recipe, thermalfile, thfileinst, 02:07:56.190-!!|THERM_T[04512]| File "/apero/apero-drs/apero/science/extract/other.py", line 384, in extract_files 02:07:56.210-!!|THERM_T[04512]| outfile.read_file() 02:07:56.229-!!|THERM_T[04512]| File "/apero/apero-drs/apero/core/core/drs_file.py", line 3270, in read_file 02:07:56.245-!!|THERM_T[04512]| dout = drs_fits.readfits(params, self.filename, getdata=True, 02:07:56.263-!!|THERM_T[04512]| File "/apero/apero-drs/apero/io/drs_fits.py", line 418, in readfits 02:07:56.278-!!|THERM_T[04512]| WLOG(params, 'error', textentry('01-001-00012', args=eargs)) 02:07:56.596-!!|THERM_T[04512]| File "/apero/apero-drs/apero/core/core/drs_log.py", line 425, in call 02:07:56.878-!!|THERM_T[04512]| raise drs_exceptions.LogExit(errorstring) 02:07:56.913-!!|THERM_T[04512]|apero.core.core.drs_exceptions.LogExit: E[01-001-00012]: Read Error: File 'AC7554BC8C_pp_e2dsff_AB.fits' could not be found in directory '/data/spirou4/apero-data/offline/reduced/22BQ13-Dec01'. 02:07:56.995-!!|THERM_T[04512]| function = io.drs_fits.py.readfits() 02:07:57.065-!!|THERM_T[04512]| 02:07:57.105-!!|THERM_T[04512]| 02:07:59.807-|THERM_T[04512]| * 02:07:59.824-@!|THERM_T[04512]|W[40-003-00005]: Recipe apero_thermal_spirou has NOT been successfully completed 02:07:59.840-*|THERM_T[04512]|

njcuk9999 commented 1 year ago

It says in the log message:

02:07:55.295- |THERM_T[04512]|A[40-016-00021]: Found and reading extracted file /data/spirou4/apero-data/offline/reduced/22BQ13-Dec01/AC7554BC8C_pp_e2dsff_AB.fits
02:07:55.358-!!|THERM_T[04512]|E[01-001-00012]: Read Error: File 'AC7554BC8C_pp_e2dsff_AB.fits' could not be found in directory '/data/spirou4/apero-data/offline/reduced/22BQ13-Dec01'.

If it finds it on disk it doesn't try extracting it again, it may mean there is an inconsistency between your database and on disk.

Does this file exist on disk? Is it in the file index database?

njcuk9999 commented 1 year ago

Actually I just looked up the code, it has nothing to do with the database.

it does os.path.exists('/data/spirou4/apero-data/offline/reduced/22BQ13-Dec01/AC7554BC8C_pp_e2dsff_AB.fits')

So there is something weird going on with that file. Can you:

Maybe the file got corrupted some how?

larnoldgithub commented 1 year ago

File exists on disk I can read it with dfits and ds9 I can open it in python and display the e2dsff Screenshot 2023-08-29 at 21 46 29

larnoldgithub commented 1 year ago

When is the file reduced/22BQ13-Dec01/AC7554BC8C_pp_e2dsff_AB.fits created during the whole calibration process ?

larnoldgithub commented 1 year ago

The processing so far: reset, precheck, preprocessing of all files ( no errors), then all calibraion processing, including REF night. I'll now go for EXTALL.

njcuk9999 commented 1 year ago

Okay weird, the e2ds file is created as part of the thermal code itself (if the file doesn't already exist on disk).

The code clearly states that it finds the e2ds on disk at an earlier stage (otherwise it would remake the data), but then the problem is these lines of code:

    if not os.path.exists(filename):
        # check directory exists
        dirname = os.path.dirname(filename)
        if not os.path.exists(dirname):
            eargs = [dirname, os.path.basename(filename), func_name]
            WLOG(params, 'error', textentry('01-001-00013', args=eargs))
        else:
            eargs = [os.path.basename(filename), dirname, func_name]
            WLOG(params, 'error', textentry('01-001-00012', args=eargs))

We see that it is going into errro 01-001-00012 which should mean that the file does not exist

i.e. the lines:

Could you try these two lines above in python? (with filename= /data/spirou4/apero-data/offline/reduced/22BQ13-Dec01/AC7554BC8C_pp_e2dsff_AB.fits) and tell me the return (True or False) for both?

larnoldgithub commented 1 year ago

Don't forget I re-did the apero_thermal_spirou.py for these 2 nights and got no error. I don't know how this may bias the analysis we are doing now.

os.path.exists(filename) True os.path.exists(os.path.dirname(filename)) True

njcuk9999 commented 1 year ago

Oh okay, maybe the file was corrupted?