Skip to content

Commit 8f0b116

Browse files
committed
add CAL to publishing step
1 parent 958b970 commit 8f0b116

2 files changed

Lines changed: 45 additions & 42 deletions

File tree

stixcore/processing/publish.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ def publish_fits_to_esa(args):
576576
"--include_levels",
577577
help="what levels should be published",
578578
type=str,
579-
default=CONFIG.get("Publish", "include_levels", fallback="L0, L1, L2, ANC, LL03"),
579+
default=CONFIG.get("Publish", "include_levels", fallback="L0, L1, L2, ANC, LL03, CAL"),
580580
)
581581

582582
parser.add_argument(

stixcore/products/CAL/energy.py

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,15 @@ def from_level1(cls, l1product, parent="", idlprocessor=None):
127127
control_index = l2.data["control_index"][spec_idx]
128128
control = l2.control[:][[control_index]]
129129

130-
# as we separate each spectra in its own product we only have one entry in the control and therefore the control_index should be always 0
130+
# as we separate each spectra in its own product we only have one entry in the control and therefore
131+
# the control_index should be always 0
131132
data["control_index"] = 0
132133
cal = EnergyCalibration(data=data, control=control)
133134

134135
cal.control.add_column(
135136
Column(
136137
name="ob_elut_name",
137-
data=str(ob_elut.file),
138+
data=str(ob_elut.file).replace(".csv", ""),
138139
description="Name of the ELUT active on instrument",
139140
)
140141
)
@@ -261,21 +262,22 @@ def from_level1(cls, l1product, parent="", idlprocessor=None):
261262
)
262263
)
263264

264-
off_gain_ecc = np.array(
265-
[
266-
4.0 * ecc_pf_df["Offset_ECC"].values.reshape(32, 12),
267-
1.0 / (4.0 * ecc_pf_df["Gain_ECC"].values.reshape(32, 12)),
268-
ecc_pf_df["goc"].values.reshape(32, 12),
269-
]
270-
)
271-
272-
cal.data.add_column(
273-
Column(
274-
name="ecc_only_offset_gain_goc",
275-
data=[off_gain_ecc],
276-
description="result of the ecc fitting only: offset, gain, goc",
277-
)
278-
)
265+
# just keeping track of ECC + post fit results for now
266+
# off_gain_ecc = np.array(
267+
# [
268+
# 4.0 * ecc_pf_df["Offset_ECC"].values.reshape(32, 12),
269+
# 1.0 / (4.0 * ecc_pf_df["Gain_ECC"].values.reshape(32, 12)),
270+
# ecc_pf_df["goc"].values.reshape(32, 12),
271+
# ]
272+
# )
273+
274+
# cal.data.add_column(
275+
# Column(
276+
# name="ecc_only_offset_gain_goc",
277+
# data=[off_gain_ecc],
278+
# description="result of the ecc fitting only: offset, gain, goc",
279+
# )
280+
# )
279281

280282
cal.data.add_column(
281283
Column(
@@ -357,30 +359,31 @@ def from_level1(cls, l1product, parent="", idlprocessor=None):
357359
) # noqa
358360
cal.data["e_edges_actual"].unit = u.keV
359361

360-
gain_ecc = off_gain_ecc[1, :, :]
361-
offset_ecc = off_gain_ecc[0, :, :]
362-
363-
# calculate the actual energy edges taking the applied ELUT into
364-
# account for calibration of data recorded with the ELUT
365-
e_actual_ecc = (ob_elut.adc - offset_ecc[..., None]) * gain_ecc[..., None]
366-
367-
e_actual_ext_ecc = np.pad(
368-
e_actual_ecc,
369-
# pad last axis by 1 on both sides
370-
pad_width=((0, 0), (0, 0), (1, 1)),
371-
mode="constant",
372-
# first pad with 0, last pad with inf
373-
constant_values=(0, np.inf),
374-
)
375-
376-
cal.data.add_column(
377-
Column(
378-
name="ecc_only_e_edges_actual",
379-
data=[e_actual_ext_ecc],
380-
description="actual energy edges fitted by ECC only",
381-
)
382-
) # noqa
383-
cal.data["ecc_only_e_edges_actual"].unit = u.keV
362+
# just keeping track of ECC + post fit results for now
363+
# gain_ecc = off_gain_ecc[1, :, :]
364+
# offset_ecc = off_gain_ecc[0, :, :]
365+
366+
# # calculate the actual energy edges taking the applied ELUT into
367+
# # account for calibration of data recorded with the ELUT
368+
# e_actual_ecc = (ob_elut.adc - offset_ecc[..., None]) * gain_ecc[..., None]
369+
370+
# e_actual_ext_ecc = np.pad(
371+
# e_actual_ecc,
372+
# # pad last axis by 1 on both sides
373+
# pad_width=((0, 0), (0, 0), (1, 1)),
374+
# mode="constant",
375+
# # first pad with 0, last pad with inf
376+
# constant_values=(0, np.inf),
377+
# )
378+
379+
# cal.data.add_column(
380+
# Column(
381+
# name="ecc_only_e_edges_actual",
382+
# data=[e_actual_ext_ecc],
383+
# description="actual energy edges fitted by ECC only",
384+
# )
385+
# ) # noqa
386+
# cal.data["ecc_only_e_edges_actual"].unit = u.keV
384387

385388
# end of ECC context block
386389
del cal.data["counts_comp_err"]

0 commit comments

Comments
 (0)