astropy

APLpy/matplotlib: Coordinate grid alpha levels for EPS quality figure

旧时模样 提交于 2019-12-08 12:20:33
问题 In the normal matplotlib axes class, it is possible to set gridlines to have a certain transparency (alpha level). I'm attempting to utilise this with the APLpy package using the following: fig = pyplot.figure(figsize=(18,8)) gridspec_layout = gridspec.GridSpec(1,2) gridspec_layout1 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gridspec_layout[1], hspace=0.0, wspace=0.0) pyplot_0 = fig.add_subplot(gridspec_layout1[0]) pyplot_1 = fig.add_subplot(gridspec_layout1[1]) pyplot_2 = fig.add

re-sizing a fits image in python

做~自己de王妃 提交于 2019-12-08 08:54:07
问题 I have 5 astronomy images in python, each for a different wavelength, therefore they are of different angular resolutions and grid sizes and in order to compare them so that i can create temperature maps i need them to be the same angular resolution and grid size. I have managed to Gaussian convolve each image to the same angular resolution as the worst one, however i am having trouble finding a method to re-grid each image in python and wondered if anyone knew how to go about doing this? I

How to convert Earth Centered Inertial (ECI) coordinates to Earth Centered Earth Fixed (ECEF) AstroPy? Other?

China☆狼群 提交于 2019-12-06 12:04:13
问题 I have position (x,y,z) and velocity (Vx,Vy,Vz) vectors in Earth Centered Inertial Coordinates (ECI) for a satellite orbit, and ultimately want to end up with geodetic coordinates (Latitude, Longitude, & Altitude). According to this other Stack Overflow question it seems that I need to convert to Earth Centered Earth Fixed (ECEF) coordinates as an intermediate step (so ECI --> ECEF --> Lat/Lon/Alt). I know ECI and ECEF share the same origin point (the center of mass of Earth) and the same z

How to convert Earth Centered Inertial (ECI) coordinates to Earth Centered Earth Fixed (ECEF) AstroPy? Other?

泄露秘密 提交于 2019-12-04 19:14:10
I have position (x,y,z) and velocity (Vx,Vy,Vz) vectors in Earth Centered Inertial Coordinates (ECI) for a satellite orbit, and ultimately want to end up with geodetic coordinates (Latitude, Longitude, & Altitude). According to this other Stack Overflow question it seems that I need to convert to Earth Centered Earth Fixed (ECEF) coordinates as an intermediate step (so ECI --> ECEF --> Lat/Lon/Alt). I know ECI and ECEF share the same origin point (the center of mass of Earth) and the same z-axis that points to the North Pole. However, I am not sure what actual equations or adjustments I need

Why features on WCS projected subplot are in the wrong place in matplotlib?

社会主义新天地 提交于 2019-12-04 02:20:08
问题 I have a fits file about an astronomical object. I can plot it like this: from astropy.io import fits from astropy.wcs import WCS hdul = fits.open(fitsfilename)[0] wcs = WCS(hdul.header) fig = plt.figure(figsize=(12,12)) fig.add_subplot(111, projection=wcs) plt.imshow(hdul.data) This works, and produces a nice pic: I would like to add some additional features to this plot, which doesn't work. For example lets try to add a circle to 119°, -67°30'. I expand the code by: plt.scatter([119],[-67.5

Astropy Fits: How to write out a table with rows sliced out?

人走茶凉 提交于 2019-12-02 02:14:33
I'm currently working with some fits tables and I'm having trouble with outputting in Astropy.io.fits. Essentially, I am slicing out a bunch of rows that have data for objects I'm not interested in, but when I save the new table all of those rows have magically reappeared. For example: import astropy.io.fits as fits import numpy as np hdu = fits.open('some_fits_file.fits')[1].data sample_slice = [True True True False False True] hdu_sliced = hdu[sample_slice] Now my naive mind expects that "hdu" has 6 rows and hdu_sliced has 4 rows, which is what you would get if you used np.size(). So if I

Astropy Fits: How to write out a table with rows sliced out?

佐手、 提交于 2019-12-02 02:07:43
问题 I'm currently working with some fits tables and I'm having trouble with outputting in Astropy.io.fits. Essentially, I am slicing out a bunch of rows that have data for objects I'm not interested in, but when I save the new table all of those rows have magically reappeared. For example: import astropy.io.fits as fits import numpy as np hdu = fits.open('some_fits_file.fits')[1].data sample_slice = [True True True False False True] hdu_sliced = hdu[sample_slice] Now my naive mind expects that

Why features on WCS projected subplot are in the wrong place in matplotlib?

独自空忆成欢 提交于 2019-12-01 12:22:05
I have a fits file about an astronomical object. I can plot it like this: from astropy.io import fits from astropy.wcs import WCS hdul = fits.open(fitsfilename)[0] wcs = WCS(hdul.header) fig = plt.figure(figsize=(12,12)) fig.add_subplot(111, projection=wcs) plt.imshow(hdul.data) This works, and produces a nice pic: I would like to add some additional features to this plot, which doesn't work. For example lets try to add a circle to 119°, -67°30'. I expand the code by: plt.scatter([119],[-67.5],c='r',s=500) What I get is: Which is really not what we wanted, the circle is around 118°5', -67°5',

Find physical coordinates of a pixel in a fits file with python

痴心易碎 提交于 2019-12-01 04:05:48
I am tying to get the physical sky coordinates of a given pixel from within a python script. I would like to use astropy's WCS, but I'll do anything from within python. I have tried these two snippets of code. from astropy.io import fits from astropy.wcs import WCS def astropymethod1(img): # from http://astropy.readthedocs.org/en/latest/wcs/ w = WCS(img) lon, lat = w.all_pix2world( 100., 100., 1) print lon, lat def astropymethod2(img): # from http://astropy.readthedocs.org/en/latest/wcs/ hdu = fits.open(img) w = WCS(hdu[0].header) lon, lat = w.wcs_pix2world(100., 100., 1) print lon, lat The

Find physical coordinates of a pixel in a fits file with python

我怕爱的太早我们不能终老 提交于 2019-12-01 01:43:20
问题 I am tying to get the physical sky coordinates of a given pixel from within a python script. I would like to use astropy's WCS, but I'll do anything from within python. I have tried these two snippets of code. from astropy.io import fits from astropy.wcs import WCS def astropymethod1(img): # from http://astropy.readthedocs.org/en/latest/wcs/ w = WCS(img) lon, lat = w.all_pix2world( 100., 100., 1) print lon, lat def astropymethod2(img): # from http://astropy.readthedocs.org/en/latest/wcs/ hdu