Open carmeloarci opened 1 year ago
The goal is to have the headers fully sufficient to recreate the exact pixel values (if desired). It seems there is no dedicated issue to track that though. These parameters and filenames are relatively easy (unlike say the random number generator seed).
There are already several 'Effects' that create such FITS headers, and it might be that what you want already works. These Effects are currently part of the Detector, because that is the last 'optical element', and therefore doubles as a simulator of the instrument control software. In MICADO_H4RG.yaml you'll find
- name : source_fits_keywords
decription : adds meta data from Source object to FITS header
class : SourceDescriptionFitsKeywords
include : True
# ValueError: The header keyword 'SIM EFF0 description' with its value is too long
# "'atmospheric spectra pulled from the skycalc server'"
#
#- name : effects_fits_keywords
# decription : adds meta dicts from all Effect objects to FITS header
# class : EffectsMetaKeywords
# include : True
# ValueError: The header keyword 'SIM CONFIG SIM file server_base_url' with its value is too long
# "'https://scopesim.univie.ac.at/InstPkgSvr/'"
#
#- name : config_fits_keywords
# decription : adds all UserCommands dicts to FITS header
# class : SimulationConfigFitsKeywords
# include : True
- name : extra_fits_keywords
decription : adds extra FITS keywords from a yaml file
class : ExtraFitsKeywords
include : True
kwargs :
filename: FITS_extra_keywords.yaml
In theory, the commented out effects_fits_keywords
effect of the EffectsMetaKeywords
class should add the keywords you want, so you could try to enable it. But it is commented out because it often (/usually) creates too long header keywords, breaking the saving of the FITS files. So this probably doesn't work now.
However, the extra_fits_keywords
of the ExtraFitsKeywords
class can be used to store almost any keyword. By default it uses FITS_extra_keywords.yaml to determine what keywords to store. E.g. the filename of the ncpa PSF used is stored under the HIERARCH WISE INS NCP REALFILE
keyword. The WISE
is there because the keyword corresponds to a MicadoWISE database column. (The REALFILE
is a kludge, that should become FILENAME
.)
The ExtraFitsKeywords
effect is still preliminary and has some problems. E.g. there is currently no mechanism for optional keywords. So it is not possible to add the anisocado keywords to the default FITS_extra_keywords.yaml
, because usually anisocado is not used, which would lead to a crash.
What should work, but that I'm not sure about, is to add an ExtraFitsKeywords
effect to MORFEO.yaml
(or MAORY.yaml
currently), using a FITS_keywords_for_morfeo.yaml
(or whatever) file that contains (only) those keywords, because then those keywords are only included when MORFEO itself is actually included. This has not been thoroughly tested though. It should also be possible to add an ExtraFitsKeywords
effect locally, e.g., in the script that you use to create the simulations, with a yaml file containing whatever you like.
With respect to the 'namespaces', ScopeSim adopts the HIERARCH extension, and (I believe) there are currently three sub categories: HIERARCH ESO
for keywords that should actually become keywords of the real raw data made by the actual instrument, HIERARCH SIM
for ScopeSim-internal keywords, and HIERARCH WISE
, for MicadoWISE specific keywords. There can be overlap between those, so the same information can end up in multiple keywords. I'd say feel free to suggest a new hierarchy if you think it is useful.
All this should be documented somewhere, but the FITS-header feature is perhaps a bit too experimental for that currently. If you are going to give it a try, then it would be much appreciated if you could share your results, what works, what doesn't, etc.
Thanks. I made some try, unfortunately I don't know how to proceed.
Specifically, I don't know the name of the variable that represent the psf filename to be written in the FITS_keywords_for_morfeo.yaml
In the MORFEO.yaml , I created the effects as:
Regards, Carmelo
Il giorno mar 4 apr 2023 alle ore 13:33 Hugo Buddelmeijer < @.***> ha scritto:
The goal is to have the headers fully sufficient to recreate the exact pixel values (if desired). It seems there is no dedicated issue to track that though. These parameters and filenames are relatively easy (unlike say the random number generator seed).
There are already several 'Effects' that create such FITS headers, and it might be that what you want already works. These Effects are currently part of the Detector, because that is the last 'optical element', and therefore doubles as a simulator of the instrument control software. In MICADO_H4RG.yaml https://github.com/AstarVienna/irdb/blob/dev_master/MICADO/MICADO_H4RG.yaml you'll find
- name : source_fits_keywords decription : adds meta data from Source object to FITS header class : SourceDescriptionFitsKeywords include : True
ValueError: The header keyword 'SIM EFF0 description' with its value is too long
"'atmospheric spectra pulled from the skycalc server'"
#
- name : effects_fits_keywords
decription : adds meta dicts from all Effect objects to FITS header
class : EffectsMetaKeywords
include : True
ValueError: The header keyword 'SIM CONFIG SIM file server_base_url' with its value is too long
"'https://scopesim.univie.ac.at/InstPkgSvr/'"
#
- name : config_fits_keywords
decription : adds all UserCommands dicts to FITS header
class : SimulationConfigFitsKeywords
include : True
- name : extra_fits_keywords decription : adds extra FITS keywords from a yaml file class : ExtraFitsKeywords include : True kwargs : filename: FITS_extra_keywords.yaml
In theory, the commented out effects_fits_keywords effect of the EffectsMetaKeywords class should add the keywords you want, so you could try to enable it. But it is commented out because it often (/usually) creates too long header keywords, breaking the saving of the FITS files. So this probably doesn't work now.
However, the extra_fits_keywords of the ExtraFitsKeywords class can be used to store almost any keyword. By default it uses FITS_extra_keywords.yaml https://github.com/AstarVienna/irdb/blob/dev_master/MICADO/FITS_extra_keywords.yaml to determine what keywords to store. E.g. the filename of the ncpa PSF used is stored under the HIERARCH WISE INS NCP REALFILE keyword. The WISE is there because the keyword corresponds to a MicadoWISE database column. (The REALFILE is a kludge, that should become FILENAME.)
The ExtraFitsKeywords effect is still preliminary and has some problems. E.g. there is currently no mechanism for optional keywords. So it is not possible to add the anisocado keywords to the default FITS_extra_keywords.yaml, because usually anisocado is not used, which would lead to a crash.
What should work, but that I'm not sure about, is to add an ExtraFitsKeywords effect to MORFEO.yaml (or MAORY.yaml currently), using a FITS_keywords_for_morfeo.yaml (or whatever) file that contains (only) those keywords, because then those keywords are only included when MORFEO itself is actually included. This has not been thoroughly tested though. It should also be possible to add an ExtraFitsKeywords effect locally, e.g., in the script that you use to create the simulations, with a yaml file containing whatever you like.
With respect to the 'namespaces', ScopeSim adopts the HIERARCH extension, and (I believe) there are currently three sub categories: HIERARCH ESO for keywords that should actually become keywords of the real raw data made by the actual instrument, HIERARCH SIM for ScopeSim-internal keywords, and HIERARCH WISE, for MicadoWISE specific keywords. There can be overlap between those, so the same information can end up in multiple keywords. I'd say feel free to suggest a new hierarchy if you think it is useful.
All this should be documented somewhere, but the FITS-header feature is perhaps a bit too experimental for that currently. If you are going to give it a try, then it would be much appreciated if you could share your results, what works, what doesn't, etc.
— Reply to this email directly, view it on GitHub https://github.com/AstarVienna/ScopeSim/issues/198#issuecomment-1495810082, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGF2TS4Z4AHVEVBGQLLIYCTW7QBI7ANCNFSM6AAAAAAWRQVM6Q . You are receiving this because you authored the thread.Message ID: @.***>
Carmelo Arcidiacono, Ph. D.
INAF Osservatorio Astronomico di Padova (OaPd) vicolo dell'Osservatorio 5, 35122, Padova, Italy
Tel. +39 049 829 3 414 (WAS 447) @. ORCID 0000-0003-0142-8108 https://orcid.org/0000-0003-0142-8108 skype: carmelo.arcidiacono pec : @.
As in the title. It would be useful to store in the header of the output file the filename of the PSF (or Anisocado params) used for the scopesim simulation.