Comments (9)
That function is using a custom rotation. Has anyone tried this using astropy.coordinates
?
from desisurvey.
PS, aren't rotations implemented by symmetric matrices? Because the rotation matrix in that function is not symmetric.
from desisurvey.
astropy.coordinates
seems fast enough in this case:
def radec2lb(ra,dec):
from astropy.coordinates import SkyCoord
from astropy import units
c = SkyCoord(ra*units.deg, dec*units.deg)
return (c.galactic.l.value, c.galactic.b.value)
n = int(1e6)
ra = np.random.uniform(0,360, size=n)
dec = np.random.uniform(-90,90, size=n) #- ok not uniform in cos(dec)
%time l,b = radec2lb(ra, dec)
CPU times: user 966 ms, sys: 216 ms, total: 1.18 s
Wall time: 1.19 s
We've had trouble with astropy.coordinates for alt,az calculations for survey planning because it wants to get things accurate to sub-arcsecond precision and it doesn't know about the earths wobble terms into the future. But for equatorial to galactic conversions this seems fine. Any objections?
from desisurvey.
from desisurvey.
OK, fair enough, I was just tying to figure out why the function was so completely wrong. Seems like astropy.coordinates
is the way to go here.
from desisurvey.
The bug was in the spherical-to-cartesian transform before the rotation was applied (the angles were mixed up). Now gives the same answer as astropy to better than 10^-5 degrees.
P.S. Ben: part of my previous comment wrong. When referring to rotation matrices about a coordinate axis, I should have said that they be decomposed into the sum of a diagonal matrix and an anti-symmetric matrix.
from desisurvey.
It's reassuring to know the source of the discrepancy, but let's switch to the astropy.coordinates version anyway since that already supports scalar, list, and numpy array inputs. This implementation only supports scalar inputs and thus will be very slow for N>>1 targets.
Please also re-enable the unit test on this to check those cases.
from desisurvey.
Note that #29 did not actually implement @sbailey's request to use astropy.coordinates.
from desisurvey.
The only call to equ2gal_J2000()
is now in afternoonplan
where it is commented out. All new desisurvey
code is using astropy.coordinates
via helper functions in desisurvey.utils
. Closing.
from desisurvey.
Related Issues (20)
- RA, Dec mix up when calling desisurvey.ephem.get_object_interpolator HOT 1
- Found invalid plan_tiles in use_plan(). HOT 4
- Consider moving freeze_iers to desiutil HOT 3
- unit tests and surveyinit failing with new tile file HOT 4
- Make tile file more flexible to changes HOT 1
- Update default fiberassign cadence HOT 1
- HA optimizations should be made more flexible
- Consider alternative status file formats
- Change mechanism by which rules and tile file are specified in afternoon planning
- Remove simulate blocks from desisurvey
- should desisurvey depend on specsim? HOT 2
- Next tile to be chosen before previous exposure is saved to disc HOT 1
- unit tests failing on NERSC HOT 4
- revive tests with GitHub actions
- desisurvey broken with astropy 4.2 HOT 8
- reading horizons_2020_week1_moon.csv broken under astropy 4.2
- Unit tests failing with speclite error HOT 1
- desisurvey.ephem is broken in current DESI releases HOT 7
- survey simulations tutorial fails with AttributeError: 'Configuration' object has no attribute 'tiles_nogray' HOT 1
- Use exposures-daily and tiles-daily instead of tsnr-exposures & tiles
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 desisurvey.