oirlab / liger_iris_pipeline

Data Reduction System (DRS) for the Thirty Meter Telescope IRIS imager/spectrograph
https://oirlab.github.io/iris-pipeline
0 stars 3 forks source link

Implementation of full frames with missing patches due to subarrays #17

Closed zonca closed 4 years ago

zonca commented 4 years ago

Implementing #15

zonca commented 4 years ago
zonca commented 4 years ago

use arrays https://jwst-pipeline.readthedocs.io/en/latest/jwst/datamodels/metadata.html#arrays

zonca commented 4 years ago

ok, this is how it works with arrays:

In [1]: import numpy as np                                                         

In [2]: import iris_pipeline                                                       

In [3]: im = iris_pipeline.datamodels.IRISImageModel()                             

In [4]: im.meta.subarray_holes                                                     
Out[4]: []

In [5]: im.meta.subarray_holes.append({"xstart":10, "ystart":20, "xsize":100, "ysiz
   ...: e":100})                                                                   

In [6]: im.meta.subarray_holes                                                     
Out[6]: [{'xstart': 10, 'ystart': 20, 'xsize': 100, 'ysize': 100}]

In [7]: im.meta.subarray_holes.append({"xstart":10, "ystart":20, "xsize":100, "ysiz
   ...: e":100})                                                                   

In [8]: im.meta.subarray_holes                                                     
Out[8]: [{'xstart': 10, 'ystart': 20, 'xsize': 100, 'ysize': 100}, {'xstart': 10, 'ystart': 20, 'xsize': 100, 'ysize': 100}]
zonca commented 4 years ago

it is not saved in the FITS header but it is anyway saved into the file using ASDF

zonca commented 4 years ago

@arunsurya77 @ikashell I am testing the subarray mask feature, can you please check this notebook and provide some feedback?

https://gist.github.com/zonca/10763c9380e567c118c0036d286b54d5

zonca commented 4 years ago

I was thinking I can assume that the metadata in the file will be already available in the raw input and I will create a step in the pipeline that creates the subarray_mask array.

zonca commented 4 years ago

read the document

"Framework Software Interface Control Document IRIS Imager (IMG) to IRIS Data Reduction System (DRS) TMT.INS.ICD.16.020.REL05(DRF02)"

again, the name of the extension is SUBARR_MAP and is created by the detector HCD. So I should create a step in the DRS which turns SUBARR_MAP into a ASDF array keyword, so we have metadata easier to handle.

zonca commented 4 years ago

ok, implemented ParseSubarrayMapStep which takes the map from the raw science frame and produces metadata and raises bit 4 of the dq array.

zonca commented 4 years ago

created a new unit test for parse subarray map which runs the full image2 pipeline on an input full frame with some subarrays.

will start from this notebook to create a sample dataset for merging back subarrays and full frame.

notebook source is in the tests folder, executed notebook: https://gist.github.com/zonca/954b54e5dc86782a8a5d535da415f600

zonca commented 4 years ago

merging this, continue development of level 3 pipeline for merging subarrays back on other Pull Request

zonca commented 4 years ago

See the documentation at:

example usage/test: