[PIPE2D-799] Correct for Jacobian when resampling Created: 27/Mar/21  Updated: 31/Mar/22  Resolved: 11/Jan/22

Status: Done
Project: DRP 2-D Pipeline
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Story Priority: Normal
Reporter: price Assignee: price
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File noJacobian.png     PNG File yesJacobian.png    
Issue Links:
Relates
relates to INSTRM-1470 Blue/Red flux ratio lower than expected Open
relates to PIPE2D-1008 Confirm units of pfsArm flux are elec... Done
Story Points: 2
Sprint: 2DDRP-2021 A 10, 2DDRP-2021 A12
Reviewers: hassan

 Description   

We need to correct for the Jacobian when resampling the wavelengths.
It would also be helpful to have a function that will provide the dispersion given a position/wavelength.



 Comments   
Comment by rhl [ 27/Mar/21 ]

At the same time please support vector-valued dispersion values in DetectorMap (which will probably be needed anyway). The code can be as simple as this, but it needs to be a method. If we know more about the insides of the map we should be able to do better.

def getDispersion(detectorMap, fiberId, wavelength, dwavelength=0.1):
    """Return the dispersion in nm/pixel
    
    detectorMap: DetectorMap
    fiberId: `int`
       The fiber whose dispersion is desired
    wavelength: `float` or iterable or `float`
       Wavelengths where the dispersion is desired
    dwavelength: `float`
       Interval to use for finite differencing to determine the dispersion
    """
    wavelength = np.atleast_1d(wavelength)
    l0 = detectorMap.findPoint(fiberId, wavelength - 0.5*dwavelength)[:, 1]
    l1 = detectorMap.findPoint(fiberId, wavelength + 0.5*dwavelength)[:, 1]

    dispersion = dwavelength/(l1 - l0)

    return dispersion
Comment by price [ 21/Dec/21 ]

pfsMerged now has units of summed counts per resampled pixel.

Comment by price [ 21/Dec/21 ]

Before:

After:

Comment by price [ 21/Dec/21 ]

A demonstration that the units of the pfsMerged is summed counts per resampled pixel:

At 637.4 nm:
Blue: 43411.88548364646 counts, dispersion 0.06598235465315838 nm/pixel
Red: 42618.45107528691 counts, dispersion 0.08778364248382786 nm/pixel
Merged: 93027.31531262455 counts, dispersion 0.08087158203125 nm/pixel
Note that (blue flux)/(blue dispersion) + (red flux)/(red dispersion) = (merged flux)/(merged dispersion)
(The error is < 1%. I’m guessing it’s not exact because there’s some variance weighting going on.)

Comment by hassan [ 08/Jan/22 ]

Changes look fine to me.

Comment by price [ 11/Jan/22 ]

Merged.

Generated at Sat Feb 10 15:58:13 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.