Comments (4)
Comment by Ned Molter on JIRA:
I made what I believe is the requisite change to the outlier step, which was to give tblot() a scale parameter equal to sqrt(pixelarea_blotimg / pixelarea_calimg). I confirmed in the C code that the pixel scale ratio it expects is in units of length, not area (the C code squares this factor later), and indeed the match between the median pixel values of the input cal image and the intermediate blot image is closest using the sqrt of this ratio.
The fraction of flagged outlier pixels is also a lot smaller with the code change, as follows.
Changed code:
2024-06-11 09:46:45,689 - stpipe.outlierdetection - INFO - New pixels flagged as outliers: 27067 (10.33%)
2024-06-11 09:46:45,851 - stpipe.outlierdetection - INFO - New pixels flagged as outliers: 70571 (26.92%)
2024-06-11 09:46:45,964 - stpipe.outlierdetection - INFO - New pixels flagged as outliers: 81067 (30.92%)
2024-06-11 09:46:46,077 - stpipe.outlierdetection - INFO - New pixels flagged as outliers: 44717 (17.06%)
Old code:
2024-06-11 09:55:54,038 - stpipe.outlierdetection - INFO - New pixels flagged as outliers: 236893 (90.37%)
2024-06-11 09:55:54,206 - stpipe.outlierdetection - INFO - New pixels flagged as outliers: 203316 (77.56%)
2024-06-11 09:55:54,321 - stpipe.outlierdetection - INFO - New pixels flagged as outliers: 194587 (74.23%)
2024-06-11 09:55:54,472 - stpipe.outlierdetection - INFO - New pixels flagged as outliers: 223848 (85.39%)
However, a caveat remains. In short, the median pixel values of the blot image remain consistently slightly offset from the median pixel values of the cal image. For the test data above, and with the changed code, the four exposures have (median Cal / median Blot) = 0.99762994, 0.9951868, 0.9948269, 0.9964127. These are a factor of 2 closer than before the change, but the offset is in the other direction; hard-coding the pixel scale ratio to 1 as was done before gives (median Cal / median Blot) = 1.0126708, 1.0099102, 1.0094519, 1.0112095.
Is this small offset expected for any reason? Is it a problem?
I noticed that the shape of the PSF is substantially different between the cal data and the blot data, but excising the regions around bright sources when computing the median value did not make any difference.
Is this even the correct code change to make? Is some ratio also needed as input to resample?
Tagging David Law Melanie Clarke Howard Bushouse, not sure who else might have insight here.
edit: development branch is found here.
from jwst.
Comment by Melanie Clarke on JIRA:
I think the ratio of areas that you're computing is not quite the right one. You have:
pix_ratio = np.sqrt(blot_img.meta.photometry.pixelarea_arcsecsq / median_model.meta.photometry.pixelarea_arcsecsq)
But instead I think you need to mirror the iscale value that's computed in the resample step, around line 265 in resample.py. Something like:
from jwst.resample.resample import _compute_image_pixel_area
input_pixflux_area = blot_img.meta.photometry.pixelarea_steradians
input_pixel_area = _compute_image_pixel_area(blot_img.meta.wcs)
pix_ratio = np.sqrt(input_pixflux_area / input_pixel_area)
Testing with this change flags outliers at about 5-6% instead of 10-30%, which seems a little more reasonable. I do still see a little offset in the overall median value of the blotted images, though, back in the other direction again, (median cal / median blot) ~ 1.002.
from jwst.
Comment by Ned Molter on JIRA:
Yes, this indeed seems to be it, thanks Melanie! For the test case, now the four exposures are roughly centered around unity: the ratios (median cal / median blot) = 1.0018555, 0.9990828, 0.9986338, 1.0003904.
from jwst.
Comment by Howard Bushouse on JIRA:
Fixed by #8553
from jwst.
Related Issues (20)
- Error in ApCorr propagation to variances HOT 2
- Background error propagation in non-IFU background subtraction HOT 2
- Add group_id to Level 3 associations HOT 2
- Investigate refpix differences across systems
- Investigate coron3 differences across systems HOT 1
- Nod Flux oversubtraction correction for NIRSpec Fixed-Slit and MOS point-source spectra HOT 1
- Move NIRSpec FS point source position assignment out of wavecorr HOT 4
- Spec3 step mrs_imatch crashing HOT 1
- extract_1d SOSS ATOCA failures on saturated data HOT 3
- Remove drizpars handling from resample steps HOT 3
- Flux differences in stage 3 products when combining multiple grating/filters HOT 1
- Improve runtime of NSClean step HOT 4
- Modify NSClean behaviour for subarray data HOT 7
- Ensure NaN values are excluded from sum in spectral extraction
- Remove "R_DRZPAR" definition from datamodels schema HOT 1
- Improve NIRSpec spec2 runtime for BOTS/MOS HOT 15
- Update the JWST pipeline to accommodate the new likelihood algorithm in ramp fitting
- Error in NIRSpec spectral WCS with all-NaN input to resample HOT 1
- Bug in extract1d._coalesce_bounds HOT 1
- extract1d._coalesce_bounds can return unexpected results HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jwst.