Skip to content

Commit

Permalink
Add read_pattern metadata to simulated files. (#89)
Browse files Browse the repository at this point in the history
* Add read_pattern metadata to simulated files.
* Actually use the computed read_pattern...
  • Loading branch information
schlafly authored Oct 30, 2023
1 parent a2b6ca8 commit 07a18aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions romanisim/l1.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def make_asdf(resultants, dq=None, filepath=None, metadata=None, persistence=Non
return out, extras


def ma_table_to_tij(ma_table_number):
def ma_table_to_tij(ma_table_number, read_time=None):
"""Get the times of each read going into resultants for a MA table.
Currently only ma_table_number = 1 is supported, corresponding to a simple
Expand All @@ -439,17 +439,21 @@ def ma_table_to_tij(ma_table_number):
ma_table_number : int or list[list]
if int, id of multiaccum table to use
otherwise a list of (first_read, n_reads) tuples going into resultants.
read_time : number
Frame read time to use. If None, use romanisim.parameters.read_time.
Returns
-------
list[list[float]]
list of list of readout times for each read entering a resultant
"""
if read_time is None:
read_time = parameters.read_time
if isinstance(ma_table_number, int):
tab = parameters.ma_table[ma_table_number]
else:
tab = ma_table_number
tij = [parameters.read_time * np.arange(f, f + n) for (f, n) in tab]
tij = [read_time * np.arange(f, f + n) for (f, n) in tab]
return tij


Expand Down
4 changes: 3 additions & 1 deletion romanisim/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from astropy.time import Time
import galsim

from romanisim import parameters
from romanisim import parameters, l1
from scipy import integrate


Expand Down Expand Up @@ -217,6 +217,8 @@ def add_more_metadata(metadata):
metadata['exposure']['exposure_time'] = openshuttertime
metadata['exposure']['effective_exposure_time'] = openshuttertime
metadata['exposure']['duration'] = openshuttertime
read_pattern = l1.ma_table_to_tij(ma_table, read_time=1)
metadata['exposure']['read_pattern'] = [list(x) for x in read_pattern]
# integration_start? integration_end? nints = 1? ...


Expand Down

0 comments on commit 07a18aa

Please sign in to comment.