Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eregion/configs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .config import *
10 changes: 9 additions & 1 deletion eregion/configs/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
import yaml
from utils.misc_utils import configure_logger
from utils import configure_logger

# A yaml constructor for slice objects
def slice_constructor(loader, node):
Expand All @@ -16,6 +16,14 @@ def slice_constructor(loader, node):
start, stop, step = values
case _:
raise ValueError("Invalid number of arguments for slice.")

if step is None:
if start > stop:
step = -1
else:
step = 1
if stop == -1:
stop = None
return slice(start, stop, step)

yaml.add_constructor('!slice', slice_constructor)
Expand Down
51 changes: 27 additions & 24 deletions eregion/configs/detectors/basic_ccd.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
## Config file for creating instances of an image class (here DetImage) for a basic CCD detector
## The DetImage instance contains the outputs from a "single" detector.
## The "image" can be stored in one FITS file with one extension that has all the detectors/outputs,
## OR in multiple FITS extensions, one per detector/output, OR in multiple FITS files, one per detector/output.
## The config structure should describe how to load one FITS file.
## Config file for creating instances of DetImage image class for a basic CCD detector
## The DetImage instance is designed to contain the outputs of a SINGLE detector (not mosaic).
## The flexibility provided by YAML allows instantiating image(s) from one FITS file with one extension that has all the detectors/outputs,
## OR from multiple FITS extensions, one per detector/output, OR from multiple FITS files, one per detector/output.
## The config structure should describe what's contained per FITS file.

## The following example describes a single CCD detector with two outputs (channels) that are read out from the same FITS extension.
## The data for each output is defined by a slice of the FITS extension (ext_slice), and the location of that data in the full DetImage data array is also defined by a slice (data_slice).
---
description: Basic single CCD detector, one channel
detector_type: CCD # (specify the type of detector, e.g., CCD, CMOS, H2RG, etc.)
detector_output_class: CCDOutput
detector_output_class: CCDOutput # (use the correct class here for the detector output type)

# List of class objects, each containing a list of outputs.
# List of Output class objects, each containing a list of outputs.
# An output is described by the FITS file it is in, the extension in that file, and the slices that define its data.
objects:
- name: 'det_1'
class: DetImage
filename_format: '*.fits*' # Use wildcard to indicate the filename
filename_format: '*.fits*' # Use wildcard to pattern match filename if needed
properties:
x_size: 2048
y_size: 4096
Expand All @@ -22,27 +25,27 @@ objects:
outputs:
- id: 'chan_1'
ext_id: 1 # FITS extension ID
ext_slice: [!slice [0, 4096], !slice [0, 1024]] # Slice of the ext_id that has the data for this output
data_slice: [!slice [0, 4096], !slice [0, 1024]] # Slice of the full DetImage data array where this output's data will go
serial_prescan: !slice [0, 0]
serial_overscan: !slice [1024, 1024]
parallel_prescan: !slice [0, 0]
parallel_overscan: !slice [4096, 4096]
ext_slice: [!slice [0, 4096], !slice [0, 1024]] # Slice of the ext_id that has the data for this output (left half)
data_slice: [!slice [0, 4096], !slice [0, 1024]] # Slice of the full DetImage data array where this output's data will go (left half)
serial_prescan: !slice [0, 20] # 20 prescan columns w.r.t. the data_slice
serial_overscan: !slice [1004, 1024] # 20 overscan columns w.r.t. the data_slice
parallel_prescan: !slice [0, 20] # 20 prescan rows w.r.t. the data_slice
parallel_overscan: !slice [4076, 4096] # 20 overscan rows w.r.t. the data_slice
parallel_axis: 'y' # First axis in the data array (rows) represent parallel readout direction
readout_pixel: [0, 0] # Readout starts at (0,0)
readout_pixel: [0, 0] # Readout of this amplifier (assumed to be away from this corner in both directions)
gain: 1.0 # electrons/ADU
read_noise: 5.0 # electrons
bias_level: 1000 # ADU
- id: 'chan_2'
ext_id: 1 # FITS extension ID
ext_slice: [!slice [0, 4096], !slice [1024, 2048]] # Slice of the ext_id that has the data for this output
data_slice: [!slice [0, 4096], !slice [1024, 2048]] # Slice of the full DetImage data array where this output's data will go
serial_prescan: !slice [0, 0]
serial_overscan: !slice [1024, 1024]
parallel_prescan: !slice [0, 0]
parallel_overscan: !slice [4096, 4096]
parallel_axis: 'y' # First axis in the data array (rows) represent parallel readout direction
readout_pixel: [0, 2047] # Readout starts at (0,2047)
ext_id: 1
ext_slice: [!slice [0, 4096], !slice [1024, 2048]] #(right half)
data_slice: [!slice [0, 4096], !slice [1024, 2048]] #(right half)
serial_prescan: !slice [2048, 2027] # 20 prescan columns w.r.t. the data_slice (on the right since readout is from the right)
serial_overscan: !slice [1044, 1023] # 20 overscan columns w.r.t. the data_slice
parallel_prescan: !slice [0, 20] # 20 prescan rows w.r.t. the data_slice
parallel_overscan: !slice [4076, 4096] # 20 overscan rows w.r.t. the data_slice
parallel_axis: 'y'
readout_pixel: [0, 2047] # Readout of this amplifier (assumed to be away from this corner in both directions)
gain: 1.0 # electrons/ADU
read_noise: 5.0 # electrons
bias_level: 1000 # ADU
Expand Down
31 changes: 23 additions & 8 deletions eregion/configs/detectors/deimos.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Example detector definition file for the DEIMOS instrument CCD array
## A single FITS file contains 8 extensions, one per detector, so 8 DetImage instances are created from this file.
## Each DetImage instance has two outputs (two channels per detector).
## Example detector definition file for the OLD DEIMOS full array.
## A single FITS file contains (at least) 8 extensions, one per detector (both outputs in same extension).
## 8 DetImage instances are defined below.
---
description: DEIMOS CCD detector array, 8 detectors with two channel readout each
detector_type: CCD # (specify the type of detector, e.g., CCD, CMOS, H2RG, etc.)
Expand Down Expand Up @@ -46,6 +46,8 @@ objects:
x_cen: -46.08 # mm
y_cen: 30.72 # mm
angle: 0.0 # degrees
flip_x: false # flip to place in focal plane assuming 0,0 is bottom left and +y is up, +x is right
flip_y: true

- name: 'det_2'
class: DetImage
Expand Down Expand Up @@ -86,6 +88,8 @@ objects:
x_cen: -15.36 # mm
y_cen: 30.72 # mm
angle: 0.0 # degrees
flip_x: false
flip_y: true

- name: 'det_3'
class: DetImage
Expand Down Expand Up @@ -126,6 +130,8 @@ objects:
x_cen: 15.36 # mm
y_cen: 30.72 # mm
angle: 0.0 # degrees
flip_x: false
flip_y: true

- name: 'det_4'
class: DetImage
Expand Down Expand Up @@ -166,6 +172,8 @@ objects:
x_cen: 46.08 # mm
y_cen: 30.72 # mm
angle: 0.0 # degrees
flip_x: false
flip_y: true

- name: 'det_5'
class: DetImage
Expand Down Expand Up @@ -203,9 +211,11 @@ objects:
read_noise: 5.0 # electrons
bias_level: 1000 # ADU
focal_plane_position:
x_cen: 46.08 # mm
x_cen: -46.08 # mm
y_cen: -30.72 # mm
angle: 0.0 # degrees
flip_x: true
flip_y: false

- name: 'det_6'
class: DetImage
Expand Down Expand Up @@ -243,9 +253,11 @@ objects:
read_noise: 5.0 # electrons
bias_level: 1000 # ADU
focal_plane_position:
x_cen: 15.36 # mm
x_cen: -15.36 # mm
y_cen: -30.72 # mm
angle: 0.0 # degrees
flip_x: true
flip_y: false

- name: 'det_7'
class: DetImage
Expand Down Expand Up @@ -283,9 +295,11 @@ objects:
read_noise: 5.0 # electrons
bias_level: 1000 # ADU
focal_plane_position:
x_cen: -15.36 # mm
x_cen: 15.36 # mm
y_cen: -30.72 # mm
angle: 0.0 # degrees
flip_x: true
flip_y: false

- name: 'det_8'
class: DetImage
Expand Down Expand Up @@ -323,10 +337,11 @@ objects:
read_noise: 5.0 # electrons
bias_level: 1000 # ADU
focal_plane_position:
x_cen: -46.08 # mm
x_cen: 46.08 # mm
y_cen: -30.72 # mm
angle: 0.0 # degrees

flip_x: true
flip_y: false



Loading