-
Notifications
You must be signed in to change notification settings - Fork 171
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
Bug in MRS extract_1d and aperture correction #5190
Comments
Comment by Jane Morrison on JIRA: David Law Howard BushouseSo as I understand the plan we will not use a radius from the the MIRI MRS aper json file (it is not defined in the file anyway) but use the wavelength dependent radius in the apcorr fits reference file. So I think we are going to need to update the SpecModel to include a radius column. Do you agree ? Also when apcorr.apply is used - for MRS MIRI data - it will be a new module we define in the ApCorrrRadial class that uses the radius information. |
I'm not clear why we'd necessarily need to add a radius column to the SpecModel, although that might be the cleanest way to carry around the information. Aperture correction doesn't strictly need to know the radius, because there's just a single vector of aperture correction values that are derived assuming that spectral extraction was done using the nominal radius at each wavelength. |
Comment by Jane Morrison on JIRA: I am starting back on this. For now I am focusing on IFU data. JP-1049 (which is think this ticket is a child of) mentions LRS and NIRSISS data as also wanting an extraction radius based on wavelength (at least I think so) But for now I will just focus on IFU data. If the input data is IFUCubeModel extract.py calls ifu.py to do the extraction. I do not think there is any plans to read in the 'radius', 'inner_bkg', 'outer_bkg','width', 'height' or theta from the extract ID json file. So as part of the update I can I clean up 'get_extract_parameters' In the routine 'extract_ifu' in ifu.py This is what I think needs to be done. David Law can you look this over and see if I have it correct:
aperture = CircularAperture(position, r=radius)
|
Hi Jane Morrison -
|
Following up on my first point; rather than having to redo the radius interpolation at each point in the loop over k wavelengths, can get_extract_parameters simply return a vector for radius, apcor, inner_bkg, and outer_bkg interpolated to the k wavelengths of the input data cube? Then the wavelength loop could simply read what it needs from this vector for a given k rather than having to do the interpolation from the input file shape[0] times within the loop. Whichever's cleaner. |
Comment by Jane Morrison on JIRA: I agree it would be better to calculate the vector of radius, apcor, inner_bkg and outer_bkg interpolated at wavelengths of cube once and then use those values in the loop over wavelengths. |
Comment by Jane Morrison on JIRA: Howard Bushouse David Law Beth Sargent I just looked at the NIRSpec apcoor file and there is no information about radius, inner bkg, outer bkg. Is it just because they have not updated the apcorr file. I don't think I have any information on the extraction radius for NIRSPec so is the plan to leave it as it is calculated in the code radius = smaller_axis/4, where smaller_axis is the smallest IFU spatial axis or should we plan for the updated apcor file - and push for that now ?
|
Comment by Beth Sargent on JIRA: I wasn't involved in the feedback/creation of the NIRSpec apcorr file. I believe James Muzerolle and Maria Pena-Guerrero were involved, so perhaps they might know more about it? |
Comment by Jane Morrison on JIRA: I am struggling to read in the extract1d file correctly. I can read in the values but for the wavelength - though the data type is float when I print it to the screen the values after the decimal are stripped out. Looking at a some other reference files that have integers and arrays in the table (like the nirspec_flat.schema.yaml - the flat_table) the nelem is in the table before the arrays. When I read in the nelem value from the extract1d table the code thinks it is an array.
|
From the github thread it looks like the wavelength issue has been solved, but I can still move nelem_wl to the first column if you want. I added it in the order here just to follow what was done on https://jira.stsci.edu/browse/JP-1049 |
@drlaw1558 Hold off on making any changes now. I might have some later but I am able to read the ref file now |
In reply to the earlier comment about NIRSpec: their apcorr file won't need inner_bkg or outer_bkg, since this will go into the Extract1D reference file instead. The apcorr file already has radius information, just for NIRSpec it's called 'SIZE'. There was a lengthy discussion in https://jira.stsci.edu/browse/JP-1049 and related meetings about naming, with the slit-type spectroscopic modes wanting to use SIZE in pixels on the detector of their spectral extraction box (HEIGHT and WIDTH weren't reliable because different instruments disperse different directions). MRS wanted to use RADIUS in arcsec, since we're extracting in circular apertures from the cube and SIZE is ambiguous whether it's a radius or a diameter. NIRSpec split the difference and used SIZE in arcsec since they share a reference file between IFU and MSA. |
Comment by Howard Bushouse on JIRA: Fixed by #5506 |
Issue JP-1615 was created on JIRA by David Law:
A couple of bugs have been encountered in testing the newly-available extract_1d and spectroscopic aperture correction code:
Major bug; the updated code does not pull information about the aperture extraction radius to use for doing point-source extractions from the apercorr reference file (per discussion at https://jira.stsci.edu/browse/JP-1049?focusedCommentId=453356&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-453356). Instead, it is still defaulting to hard-coded values of 1/4 the size of the data cube.
Minor bug; values for wavelength, size/radius, and apcorr from the aperture correction reference file are read in by apply_apcorr.py. Since the input size/radius is in units of arcsec, apply_apcorr.convert_size_units converts it to units of spaxels using assign_wcs.util.compute_scale. However, compute_scale returns the scale in degrees where convert_size_units assumes that the value was returned in arcsec, therefore the radius is given as about 13,000 pixels instead of about 3 pixels. This doesn't cause a problem for the MRS since here since we don't use that column during aperture correction, but could cause major issues for other instruments/modes and should be fixed.
The text was updated successfully, but these errors were encountered: