Running a simple test recipe

The following example describes how to employ the fridadrp-ifu_simulator script to generate a couple of simple exposures (target and sky) and execute a very simple reduction recipe.

Initialize the file tree

Download the following file fridadrp_initial_tree_test1.tgz

(venv_frida) $ mkdir test1
(venv_frida) $ cd test1

# copy here the downloaded tgz file

(venv_frida) $ tar zxvf fridadrp_initial_tree_test1.tgz
...
...
(venv_frida) $ rm fridadrp_initial_tree_test1.tgz
(venv_frida) $ tree
.
├── control.yaml
├── data
│   ├── master_bpm_zeros.fits
│   ├── master_dark_zeros.fits
│   └── master_flat_ones.fits
├── scene_sky.yaml
├── scene_target.yaml
└── test1.yaml

Execute the simulator

Simulate the target exposure

(venv_frida) $ fridadrp-ifu_simulator \
 --scene scene_target.yaml \
 --grating medium-K \
 --scale fine \
 --prefix_intermediate_FITS target
...
...
Saving file: target_ifu_white2D_method0_os10.fits
Saving file: target_ifu_white2D_method0_os1.fits
Saving file: target_ifu_3D_method0.fits
Saving file: target_rss_2D_method0.fits
Saving file: target_detector_2D_method0.fits
Saving file: target_rss_2D_method1.fits
Saving file: target_ifu_3D_method1.fits

Copy the simulated detector image in the data/ subdirectory

(venv_frida) $ cp target_detector_2D_method0.fits data
image target_detector_2D_method0.png

Simulate the sky exposure

(venv_frida) $ fridadrp-ifu_simulator \
  --scene scene_sky.yaml \
  --grating medium-K \
  --scale fine \
  --prefix_intermediate_FITS sky
...
...
Saving file: sky_ifu_white2D_method0_os10.fits
Saving file: sky_ifu_white2D_method0_os1.fits
Saving file: sky_ifu_3D_method0.fits
Saving file: sky_rss_2D_method0.fits
Saving file: sky_detector_2D_method0.fits
Saving file: sky_rss_2D_method1.fits
Saving file: sky_ifu_3D_method1.fits

Copy the simulated detector image in the data/ subdirectory

(venv_frida) $ cp sky_detector_2D_method0.fits data
image sky_detector_2D_method0.png

Running the reduction recipe

Note

Remember that the numina script is the interface with GTC pipelines. In order to execute PyEmir recipes you should type something like:

(venv_frida) $ numina run <observation_result_file.yaml> -r <requirements_file.yaml>

where <observation_result_file.yaml> is an observation result file in YAML format, and <requirements_files.yaml> is a requirements file, also in YAML format.

YAML is a human-readable data serialization language (for details see YAML Syntax)

We are going to execute numina using the observation result file test1.yaml.

(venv_frida) $ cat test1.yaml
id: _test1
instrument: FRIDA
mode: test1
frames:
  - target_detector_2D_method0.fits
  - sky_detector_2D_method0.fits
enabled: True
(venv_frida) $ numina run test1.yaml -r control.yaml
...
...

After the execution of the previous command, two subdirectories should have appeared, with the syntax obsid<id>_<work/results>. In this particular example, these two subdirectories are obsid_test1_work and obsid_test1_result.

All the images (scientific and calibrations) involved in the reduction of a particular block of the observation result file are copied into the ...work subdirectories in order to preserve the original files. The results of the execution of the reduction recipe are stored in the corresponding ...results subdirectory.

(venv_frida) $ tree obsid_test1_*
obsid_test1_results
├── processing.log
├── reduced_image.fits
├── result.json
└── task.json
obsid_test1_work
├── index.pkl
├── sky_detector_2D_method0.fits -> /Users/cardiel/test1/data/sky_detector_2D_method0.fits
└── target_detector_2D_method0.fits -> /Users/cardiel/test1/data/target_detector_2D_method0.fits
image reduced_image.png