Comments (4)
Yes, you're right about this. It should be flux_ratio *= std::abs(invdet * imscale)
to get an extra factor of imscale
. Thanks for catching this!
Fortunately, it's a pretty severe edge case. The normal paths of drawing in GalSim usually end up at this point with imscale=1, so the error doesn't cause any problems (which is probably why no one ever noticed it until now).
I think the only way to hit this case is to:
- Use
obj.drawReal()
directly rather than the usualobj.drawImage()
. - The object being drawn needs to be transformed with a non-diagonal transformation (either shear or rotation).
- The image being drawn onto needs to have a non-unit pixel scale (but note that it's not allowed to have a non-PixelScale wcs).
So, it's definitely worth fixing of course, but it's notable that there is no code in our current test suite that hits this situation, never mind has a test that should have noticed the flux being wrong. So I suspect it most likely hasn't ever caused an error in anyone's images. Thank goodness. :)
I'll make a PR with the fix shortly.
from galsim.
I'm glad to have found something valuable.
If I can add a question, here is one: does in the code
double mA = jac[0];
double mB = jac[1];
double mC = jac[2];
double mD = jac[3];
means that the jacobian matrix is set as (convention)
\begin{matrix}
mA & mB \\
mC & mD
\end{matrix}
or
\begin{matrix}
mA & mC \\
mB & mD
\end{matrix}
(it is a matter of transpose or not)
In fact I'm a bit trouble by this in GalSim/SBProfile.cpp/draw()
double mA = jac[0];
double mB = jac[1];
double mC = jac[2];
double mD = jac[3];
double det = mA*mD - mB*mC;
double invdet = 1./det;
double new_x0 = (mD*x0 - mB*y0) * invdet;
double new_y0 = (-mC*x0 + mA*y0) * invdet;
which would make sense if
J = \begin{matrix}
mA & mB \\
mC & mD
\end{matrix}
=>
J^{-1} = (mA mD - mB mC)^{-1} \begin{matrix}
mD & -mB \\
-mC & mA
\end{matrix}
as then
\begin{matrix}
new_x0 \\ new_y0
\end{matrix}
= J^{-1} \times \begin{matrix}
x0 \\ y0
\end{matrix}
But looking at drawK method I read
double mA = jac[0];
double mB = jac[1];
double mC = jac[2];
double mD = jac[3];
double new_x0 = mA*x0 + mC*y0;
double new_y0 = mB*x0 + mD*y0;
which would mean that jac is this routine is like the transpose of the previous one.
Have I missed something?
Thanks
from galsim.
The effect of the Jacobian is transposed in Fourier space. So that's correct. J = [[ a, b], [c, d]]. But in Fourier space, you apply J^T.
from galsim.
Ok. +1
from galsim.
Related Issues (20)
- Can't photon shoot simple chromatic transformation HOT 1
- Small Discrepancy between Real and Fourier Space Shift HOT 4
- Colab install failed error: metadata-generation-failed HOT 1
- Monochromatic SED HOT 2
- BUG in FFTs? HOT 5
- Remove hidden scipy dependency
- SED flux type units lost in translation HOT 2
- Installation issue (FFTW problem with Apple ARM) HOT 2
- define `origin` and `world_origin` for CelestialWCS classes? HOT 8
- CelestialWCS method docstring erratum?
- Quintic interpolant (ALT_QUINTIC) uval: sign pb HOT 2
- Construct images without sanity checks in `_convertMask` function in the HSM module HOT 5
- New quintic kernel for interpolation in Fourier Space
- Sum over ghosts or use a diffrent formula for periodic cardinal sinus.
- maxk approximation used in Exponential profile HOT 2
- Spergel shoot photon for nu<0 HOT 2
- Accept pathlib.PosixPath in places where a basestring file_name is currently allowed.
- `save_photons` does not work for `ChromaticAiry` HOT 1
- Image array throws error about having no setter but still performs operation HOT 9
- numerical issue for some realizations of atmosphere HOT 29
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 galsim.