-
Notifications
You must be signed in to change notification settings - Fork 38
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
Correct calculation of n1_exposure_time for HAP images #1852
Comments
Comment by Rick White on JIRA: Here is the line in for edp in total_product_obj.edp_list:
tot_exposure_time += edp.exptime
if n1_dict[edp.filters]['n'] == 1:
n1_exposure_time += edp.exptime
n1_factor += cr_residual A simple approach can fix it. Add a test outside the loop to compute if max([x['n'] for x in n1_dict.values()]) > 1:
for edp in total_product_obj.edp_list:
tot_exposure_time += edp.exptime
if n1_dict[edp.filters]['n'] == 1:
n1_exposure_time += edp.exptime
n1_factor += cr_residual That assumes that the total image is correctly computed by including only the |
Comment by Michele De La Pena on JIRA: I am afraid your suggestion of a fix does not work. I admit that I do not quite understand what the goal is at this time, so I am finding it hard to correct the algorithm. In this example there are 5 exposures, 1-f435w (360s), 1-f814w (375s), and 3-f555w (225s, 375s, 375s). In this case the code which creates the n1_dict will create the SAME n1_dict over every filter_product_obj loop because the n1_dict is created from all of the exposures in the total_project_obj.edp_list which is all 5 exposures and there is only one total_product_object because there is only one detector in play.
Would it be easier if we talked? If you have time as it seems you might be on vacation. In the mean time I will keep studying this code.
|
Comment by Michele De La Pena on JIRA: You say
|
Comment by Rick White on JIRA: Michele De La Pena Here is a list of datasets from the regression test that have incorrectly rejected catalogs:
|
Comment by Michele De La Pena on JIRA: Rick White Robert Swaters Having said this, there is still an issue I need to check. I did an additional test by using one of the datasets above, BUT by using only a single exposure from each filter. Since there is only a single exposure for each filter, the algorithm will use all three exposures to create the total detection image (ref: HLA-1138). As expected the resultant drizzled image has cosmic rays present. The n1_exposure_time = tot_exposure_time = the sum of the exposure times for each of the constituent images. The catalogs are rejected for example
I will need to modify the rejection function in catalog_utils.py. This is further reinforced by an HRC dataset which I processed. First, I only used 6 images from j96u01 to create a detection image. All is fine. Then I used only three single exposure images. The n1_* and tot* exposure times were correctly computed. The image only has one or two objects and is VERY clean. However, the catalogs were rejected as seen below. This algorithm needs to be updated. Again, the HRC images are fairly clean, short exposures, with a small FOV.
Comments? |
Comment by Michele De La Pena on JIRA: I see the current problem as two issues which might be solved with one good fix. HRC images are much smaller than UVIS, WFC, or WFPC2 images so the crfactor needs to be different (unless this entire equation is scrapped for a better criterion).Because single filter exposures are now eliminated from the total detection image, the threshold for computing which catalogs should be eliminated no longer seems applicable in general: {}thresh = crfactor * n1_exposure_time{}{}2 / texptime.{}The crfactor is set based upon catalog_type: crfactor = {'aperture': 300, 'segment': 150} # CRs / hr / 4kx4k pixels I do not know how these numbers were computed, but more importantly, they do not apply to HRC, as is. Also, the threshold is computed as {}thresh = crfactor * n1_exposure_time{}{}2 / texptime{} with the rejection as if n_sources < thresh and 0 < n_sources: For detection images with have multiple exposures per filter, the {}thresh is zero{}. As long as these detection images have any found sources, they will NOT be rejected. For detection images composed of ONLY single filter exposures, n1_exposure_time=texptime. This means the n_sources must effectively exceed the sum of "expected_CRs + real_sources)". Hmmm. I guess this can be true – just not in my test cases. This means these types of catalogs will probably mostly fail. As such, the thresh (unless I am crazy) has basically been diluted. A new criterion is necessary. |
Comment by Rick White on JIRA: Michele De La Pena I was the one who created the criterion for rejection. So I should be able to explain it! The idea is that the number of CRs in the image can be roughly predicted from the exposure time. If all the filters have thresh = crfactor * n1_exposure_time The test to reject is The
So then the crfactor = 150 * ((1024*21)/(4096*15))**2 = 18.5 # for HRC segment
crfactor = 300 * ((1024*21)/(4096*15))**2 = 37 # for HRC point |
Comment by Rick White on JIRA: Michele De La Pena For WFPC2, the same approach can be used to get
So crfactor = 150 * ((1600*15)/(4096*15))**2 = 23 # for WFPC2 segment
crfactor = 300 * ((1600*15)/(4096*15))**2 = 46 # for WFPC2 point |
Issue HLA-1295 was created on JIRA by Rick White:
There is an error in the logic that rejects catalogs for cosmic ray contamination. An example is image
hst_11570_0b_acs_wfc_total_jb1f0b
. The current version of the image from the HST public cache is in fact filled with CRs, as can be seen from the HLA interactive display. The visit has single exposures in thef435w
andf814w
filters plus 3 exposures in thef555w
image. Despite the CRs, this old version of the catalog was accepted (there are enough additional non-CRs to make it considered possible to use).But the new version of the image in the regression tests does not have CRs. This is a good thing! The CR-contaminated single filters were not included in the
total
image. I checked the header of thetotal
image and confirmed that it contains only thef555w
exposures. Here is the HLA interactive display for the new image, which looks excellent.Unfortunately, the catalogs for this very good image were rejected by the CR contamination test. The problem is that the test uses a calculation that assumes that all the filters got used to generate the
total
image. It uses an equation that relies on the total exposure time in filters that have only a single exposure. For the new image, that number should be zero. Instead it is computed as 81.585 secs. Here are some (edited) lines from thehst_11570_0b_acs_wfc_total_jb1f0b_trl.txt
trailer file:This means that the catalogs are getting incorrectly rejected for all of these images that now do not include CRs.
This should be pretty simple to fix. Code fix will be discussed in the comments.
The text was updated successfully, but these errors were encountered: