Comments (8)
either define origin / world_origin (could be crpix and center for GSFitsWCS) or have them raise useful errors
I'm fine with that. I can't remember the reasoning behind the current implementation, but if someone want to track through the unit tests to see what breaks if origin = crpix, I don't have a problem with that. I think world_origin=center isn't something we can guarantee always though after possible calls to newOrigin. Could be wrong though.
document center or similar as the attribute that holds the center of the projection if a Celestial WCS has a projection in use, otherwise it raises
That's not particularly feasible for the other possible CelestialWCS classes. But you could do it for GSFitsWCS and RaDecFunction I think. Or if you want to try to figure out how to make a best-effort attempt for AstropyWCS and PyAstWCS, you could do that and raise an exception if it's too obfuscated to figure out. (Which I think will be the case for some wcs types.)
from galsim.
Yes, center is that point, and yes it's largely undocumented. It's not a general WCS property for all CelestialWCS classes -- it's specific to the GSFitsWCS class. So you can't rely on it if you are using galsim.FitsWCS
to generically read in a WCS from a FITS file (the return value isn't necessarily a GSFitsWCS object in that case). But if you are directly enforcing that you have a galsim.GSFitsWCS
, then feel free to use it.
Is there a reason we couldn't set origin to CRPIX or similar and set world_origin to the tangent point on the sphere?
You certainly can do that. But neither of those has any requisite connection to the center of the tangent plane projection, so that's just a choice you can make.
from galsim.
I must have made a typo when checking this last night! Here is what I see:
>>> coadd_wcs
galsim.GSFitsWCS(_data = ['TAN', array([5000.5, 5000.5]), array([[-7.305555555556e-05, 0.0], [0.0, 7.305555555556e-05]]), coord.CelestialCoord(coord.Angle(1.0591757458530349, coord.radians), coord.Angle(-0.43579901019234296, coord.radians)), None, None, None])
>>> coadd_wcs.center
coord.CelestialCoord(coord.Angle(1.0591757458530349, coord.radians), coord.Angle(-0.43579901019234296, coord.radians))
>>> coadd_wcs.origin
galsim.PositionD(x=0.0, y=0.0)
>>> coadd_wcs.world_origin
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'GSFitsWCS' object has no attribute 'world_origin'
so we do have .center
and it is as expected. .origin
is defined but not clear what it's use is. .world_origin
is not defined.
from galsim.
.cprix
is also available, but maybe it's enough to know that it exists?
>>> coadd_wcs.crpix
array([5000.5, 5000.5])
from galsim.
Oh, right. Yeah, world_origin isn't a thing for CelestialWCS objects. Just Euclidean ones. I forgot about that. I guess we could define world_origin to be wcs.toWorld(wcs.origin). But I'm not sure how useful that is, and it's not necessarily the center of the projection.
If you make it via TanWCS
, then the world_origin parameter there does become the wcs.center attribute. But we don't persist that name as an attribute in the constructed wcs.
from galsim.
Yeah origin is set to a dummy value in the code. It should probably raise since using the dummy value is almost always wrong and will give unexpected results.
from galsim.
All the origin/world_origin stuff is really just to make sure we can recenter images (e.g.im = im.setCenter(0,0)
) and have the WCS remain consistent in terms of what point on the sky each actual pixel refers to. GSFitsWCS manages this by updating crpix.
from galsim.
Right yes. crval and crpix are the fits conventions for these things. I think I expected
- to not have dummy properties that don't have real meaning attached
- for there to be origin and world_origin attached to all WCS classes since these concepts exist for each kind of WCS no matter what
I agree that we cannot use the convention that the projection center for the tagent plane is world_origin for all celestial WCSs.
So maybe a small change in API would be to
- either define origin / world_origin (could be crpix and center for GSFitsWCS) or have them raise useful errors
- document center or similar as the attribute that holds the center of the projection if a Celestial WCS has a projection in use, otherwise it raises
from galsim.
Related Issues (20)
- 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
- DoubleZernike.__call__ ought to handle integers
- Only photons from the final object in a `ChromaticSum` are saved HOT 1
- Build MacOS ARM wheels HOT 1
- `setuptools.dep_util` is deprecated and will be removed soon. Alternative suggested is `setuptools.modified`. HOT 1
- Unsigned integer in-place addition problems with numpy=2 HOT 1
- Additional functionality for interpolated chromatic images HOT 5
- comma/space delimited PositionD string parsed incorrectly in config layer HOT 1
- Drawing error for ChromaticConvolution with pixel response HOT 10
- Galsim can work in windows environment HOT 3
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.