GalSim-developers / GalSim-developers/GalSim

Photon shooting with OpticalPSF/InterpolatedImage gives different results on Mac ARM and Linux

Open
#1,350 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

numerics optics/atm
Dominant language
Python
Stars
272
Forks
121
PR merge metrics
No merged PRs in 30d

Description

I noticed that I found different results depending if I run some code on Linux or on my laptop with Mac ARM. I tracedback the issue to photon shooting through OpticalPSF but at some point it gets transformed to an InterpolatedImage. I figure that the difference is at this line. I manage to figure that _xInterp is galsim._galsim.Quintic but I wasn't able to find the shoot method.
Here is simple code that returns different results on Mac ARM and Linux (galsim version: 2.9)

import galsim
import galsim.roman as roman

bp = roman.getBandpasses()["J129"]
psf = galsim.OpticalPSF(
    diam=roman.diameter,
    lam=bp.effective_wavelength,
)

psf.shoot(5, galsim.BaseDeviate(1234)).x

On my Mac I get:

array([ 0.00834068, -0.01800069, -0.10280517,  0.0007287 ,  0.05277417])

On Linux I get:

array([-0.00932278, -0.05793788, -0.10280517, -0.00044896,  0.02334157])

When drawing galaxy profile, the number of photons drawn is the same and the flux of the photons is the same but they end up at different locations.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducer and inspect src/SBInterpolatedImage.cpp around line 1306, following the OpticalPSF-to-InterpolatedImage path. Investigate how _xInterp, identified as galsim._galsim.Quintic, participates in photon shooting, then run the supplied snippet on Mac ARM and Linux. Done means the platform-dependent photon locations are explained and the discrepancy is resolved or documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.