-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cosmics kgain #211
base: main
Are you sure you want to change the base?
Cosmics kgain #211
Changes from all commits
cc91b02
0ba18e3
91cfaa0
2a96946
3cab82f
3f2029b
7329838
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ def prescan_biassub(input_dataset, noise_maps=None, return_full_frame=False, | |
|
||
return output_dataset | ||
|
||
def detect_cosmic_rays(input_dataset, detector_params, sat_thresh=0.7, | ||
def detect_cosmic_rays(input_dataset, detector_params, k_gain = None, sat_thresh=0.7, | ||
plat_thresh=0.7, cosm_filter=1, cosm_box=3, cosm_tail=10, | ||
mode='image'): | ||
""" | ||
|
@@ -166,6 +166,7 @@ def detect_cosmic_rays(input_dataset, detector_params, sat_thresh=0.7, | |
Args: | ||
input_dataset (corgidrp.data.Dataset): a dataset of Images that need cosmic ray identification (L1-level) | ||
detector_params (corgidrp.data.DetectorParams): a calibration file storing detector calibration values | ||
k_gain (corgidrp.data.KGain): KGain calibration file | ||
sat_thresh (float): | ||
Multiplication factor for the pixel full-well capacity (fwc) that determines saturated cosmic | ||
pixels. Interval 0 to 1, defaults to 0.7. Lower numbers are more aggressive in flagging saturation. | ||
|
@@ -205,9 +206,12 @@ def detect_cosmic_rays(input_dataset, detector_params, sat_thresh=0.7, | |
|
||
crmasked_cube = crmasked_dataset.all_data | ||
|
||
|
||
# Calculate the full well capacity for every frame in the dataset | ||
kgain = np.array([detector_params.params['kgain'] for frame in crmasked_dataset]) | ||
if k_gain == None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should use |
||
kgain = np.array([detector_params.params['kgain'] for frame in crmasked_dataset]) | ||
else: | ||
#get the kgain value from the k_gain calibration file | ||
kgain = k_gain.value | ||
emgain_list = [] | ||
for frame in crmasked_dataset: | ||
try: # use measured gain if available TODO change hdr name if necessary | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
{ | ||
"name" : "detect_cosmic_rays", | ||
"calibs" : { | ||
"DetectorParams" : "AUTOMATIC" | ||
"DetectorParams" : "AUTOMATIC", | ||
"KGain" : "AUTOMATIC, OPTIONAL" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for this and other recipes below, can the indentation be at the same level? |
||
}, | ||
"keywords" : { | ||
"mode" : "full" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If kgain is None, use the value from detector_params. And k_gain would have to be listed before detector_params in the list of arguments so that the "AUTOMATIC, OPTIONAL" works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way: is there a reason why an array of equal kgain values is made? We can divide an array by a scalar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, not really needed to have an array since we are not assuming to deal with different kgain values right now