Open larnoldgithub opened 4 months ago
@njcuk9999 Interestingly Apero is complaining about not finding a blaze in lbl/calib/ but I have checked the blaze is present in the main calib/ directory. There is definitely an issue with the last version of lbl and the building of the sym links; Maybe this test where I removed all cals from red/ will help you locating the bug.
I've no idea whats going on...
Do you have SCIENCE_TARGETS
set in mini_run2_EXTRACT_etc.ini
maybe that is blocking FP_FP and blaze files from being moved (as they don't match your SCIENCE_TARGET object name).... its just a theory but it might explain it?
SCIENCE_TARGETS = Gl699 in the mini_run2_EXTRACT_etc.ini
that was working in my previous tests. it fails now only after apero_reset having cleaned up ONLY red/ After that reset, Apero needs to update its databases as usual when files are removed/added but I didn't see any issue.
I see that when I have rebuilt the container, the git pull get the LBL VERSION: 0.63.007, not 006. Is this ok ?
test_helu is my profile
apero-data/test_helu/lbl/calib/ only contains sample_wave_grid_spirou.fits. No blazes etc.
Okay, could you run apero_lbl_ref.py and send me the full log (probably by email) I need to see what apero_lbl_ref_spirou.py
is doing.
So from your log this is the problem:
04:31:50.722- |GET| ***************************************************************************
04:31:50.729- |GET| *
04:31:50.730- |GET| * SPIROU @PID-00017122051105899020-9M6H (V0.7.289)
04:31:50.730- |GET| * py3.9.18 git:v0.7.289-stable-test
04:31:50.730- |GET| *
04:31:50.736- |GET| ***************************************************************************
04:31:50.743- |GET| █████╗ ██████╗ ███████╗██████╗ ██████╗
04:31:50.750- |GET| ██╔══██╗██╔══██╗██╔════╝██╔══██╗██╔═══██╗
04:31:50.757- |GET| ███████║██████╔╝█████╗ ██████╔╝██║ ██║
04:31:50.763- |GET| ██╔══██║██╔═══╝ ██╔══╝ ██╔══██╗██║ ██║
04:31:50.770- |GET| ██║ ██║██║ ███████╗██║ ██║╚██████╔╝
04:31:50.777- |GET| ╚═╝ ╚═╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝
04:31:50.783- |GET| ***************************************************************************
04:31:50.792-**|GET| DRS Setup:
04:31:50.799-**|GET|
04:31:50.799-**|GET| DRS_ROOT: /opt/apero-drs/apero
04:31:50.799-**|GET| DRS_DATA_RAW: /apero-data/test_helu/raw
04:31:50.800-**|GET| DRS_DATA_REDUC: /apero-data/test_helu/red
04:31:50.800-**|GET| DRS_DATA_WORKING: /apero-data/test_helu/tmp
04:31:50.800-**|GET| DRS_CALIB_DB: /apero-data/test_helu/calib
04:31:50.800-**|GET| DRS_TELLU_DB: /apero-data/test_helu/tellu
04:31:50.800-**|GET| DRS_DATA_ASSETS: /apero-data/test_helu/asset
04:31:50.800-**|GET| DRS_DATA_OUT: /apero-data/test_helu/out
04:31:50.800-**|GET| DRS_DATA_MSG: /apero-data/test_helu/log
04:31:50.800-**|GET| DRS_DATA_RUN: /apero-data/test_helu/run
04:31:50.801-**|GET| DRS_DATA_PLOT: /apero-data/test_helu/plot
04:31:50.801-**|GET| DRS_DATA_OTHER: /apero-data/test_helu/other
04:31:50.801-**|GET| LBL_PATH: /apero-data/test_helu/lbl
04:31:50.801-**|GET| DRS_CONFIG: /opt/apero-drs/config/test_helu/user_config.ini
04:31:50.801-**|GET| DRS_CONFIG: /opt/apero-drs/config/test_helu/user_constants.ini
04:31:50.801-**|GET| DRS_CONFIG: apero.constants.default.default_config
04:31:50.801-**|GET| DRS_CONFIG: apero.constants.default.default_keywords
04:31:50.801-**|GET| DRS_CONFIG: [config.instruments.spirou.default_config.py](http://config.instruments.spirou.default_config.py/)
04:31:50.802-**|GET| DRS_CONFIG: [config.instruments.spirou.default_keywords.py](http://config.instruments.spirou.default_keywords.py/)
04:31:50.802-**|GET| DRS_CONFIG: [core.instruments.default.default_constants.py](http://core.instruments.default.default_constants.py/)
04:31:50.802-**|GET| DRS_CONFIG: [core.instruments.spirou.default_constants.py](http://core.instruments.spirou.default_constants.py/)
04:31:50.802-**|GET| DATABASE: MYSQL
04:31:50.802-**|GET| DATABASE-calib: spirou@pupus-mysql:calib_test_helu_db
04:31:50.802-**|GET| DATABASE-tellu: spirou@pupus-mysql:tellu_test_helu_db
04:31:50.802-**|GET| DATABASE-findex: spirou@pupus-mysql:findex_test_helu_db
04:31:50.802-**|GET| DATABASE-log: spirou@pupus-mysql:log_test_helu_db
04:31:50.802-**|GET| DATABASE-astrom: spirou@pupus-mysql:astrom_test_helu_db
04:31:50.803-**|GET| DATABASE-lang: spirou@pupus-mysql:lang_test_helu_db
04:31:50.803-**|GET| DATABASE-reject: spirou@pupus-mysql:reject_test_helu_db
04:31:50.803-**|GET| PRINT_LEVEL: all
04:31:50.803-**|GET| LOG_LEVEL: all
04:31:50.803-**|GET| DRS_PLOT: 0
04:31:50.810- |GET| ***************************************************************************
04:31:50.817-**|GET| Arguments used:
04:31:50.823-**|GET|
04:31:50.823-**|GET| --OUTPATH: /apero-data/test_helu/lbl/calib
04:31:50.824-**|GET| --SYMLINKS: True
04:31:50.824-**|GET| --OBJNAMES: None
04:31:50.824-**|GET| --OUTTYPES: FF_BLAZE,WAVE_NIGHT
04:31:50.824-**|GET| --FIBERS: C
04:31:50.824-**|GET| --SINCE: None
04:31:50.824-**|GET| --NOSUBDIR: True
04:31:50.824-**|GET| --TEST: False
04:31:50.831- |GET| ***************************************************************************
04:31:50.999- |GET| Loading file index database
04:31:51.010- |GET| Loading astrometric database
04:31:51.020- |GET| Loading log database
04:31:51.030- |GET| Processing KW_OBJNAME=
04:31:51.061- |GET| Found no entries
04:31:51.069- |GET| Excluded 0 files for failing QC
04:31:51.076-**|GET| ***************************************************************************
04:31:51.084-**|GET| Recipe apero_get has been successfully completed
04:31:51.092-**|GET| ***************************************************************************
04:31:51.173-**|LBLREF[00000]| QUALITY CONTROL SUCCESSFUL - Well Done -
04:31:51.188-**|LBLREF[00000]| ***************************************************************************
04:31:51.196-**|LBLREF[00000]| Recipe apero_lbl_ref_spirou has been successfully completed
04:31:51.204-**|LBLREF[00000]| ***************************************************************************
Inside apero_lbl_ref
we use apero_get
to symlink the files - the last one copies the FF_BLAZE and WAVE_NIGHT it find no files thus you'll obviously have no blaze or wave in the lbl directory. There is no error given as apero_get
just gets what you ask for, if it isn't there it continues to the next query - or in this case just does nothing.
apero_get
uses the file index database not the calibration or telluric database so that is the problem... you removed the files from the red directory (and thus the file index database) so as far as apero_get is concerned you have no blaze or wave files.
But there are reduced o.fits in red/, how apero_get is not finding them ? only the calib files have been removed before the extraction etc. Are you saying that for each object found in red/, apero symlink the required Blaze and Wave from red/night/ and not from calib/ ? Sorry I don't understand the way it works.
Also how would you explain the other problem I have with Apero missing blaze files, while there are in calib/ ? I will run apero_lbl_ref only as above, and look at the log.
Are you saying that for each object found in red/, apero symlink the required Blaze and Wave from red/night/ and not from calib/ ?
Yes, for LBL only it is apero_get
that does this which is called inside apero-lbl-ref_spirou.py
The problem is the following, apero_get only deals with the "file index database". You'll recall there are 7 tables in the database:
The problem is apero_get
was designed for the file index database only - it requires the full path to files, some key header values including DRSOBJN and DRSOUTID and deals with things in a "observation night" directory - based on some input from the user it gets files from the file index database and puts them where the user requires (either as symlinks or hard copies). These header keys and full path are not in the calibration or telluric database.
The calibration directory and calibration database are completely separate from the file index database - there are no entries in the file index database for files in the calibration (or telluric) database - therefore if you remove BLAZE and WAVE files from the tmp/red/out/lbl directories (file indexed locations) apero_get thinks those files do not exist anymore anywhere.
I would have to re-write apero_lbl_ref_spirou.py
to somehow get files from the calibration database but currently, this isn't easy as we never use the calibration or telluric database this way (we never copy these files just open them when needed) I cannot make lbl do this as lbl is a separate code - so I have to somehow find a way to symlink these files from the calibration database instead of from the tmp/red/out/lbl directories (file indexed locations).
Currently, any file you require in lbl will break if you remove it from the tmp/red/out/lbl directories (file indexed locations) as they are all symlinked.
I will try to add an option to "not symlink lbl files" that will hard copy all files, but this would mean you could never do an apero_reset.py on the lbl directory (as it would remove files that then would not be recopied from the tmp/red/out/lbl directories as you would have deleted them) and would also increase disk usage as you would have copies of all lbl files in the lbl directory.
I guess my best solution would actually be to have an option to only symlink from the telluric/calib directories (which you are not deleting) but this would mean you only get files that pass QC and any files that failed QC would not be copied. (Note that you may want to run lbl on files that fail lbl telluric correction).
Currently, most of these options are a lot of work.
I have processed the mini dataset 2 in 2 steps: 1/ up to the calibrations 2/ then I removed calibrations from red/ (using apero_reset) and ran the rest of the processing: EXTTELL, EXTRACT etc up to LBL
Everything was fine but the LBL at the end of the processing.