Menu
  • HOME
  • TAGS

astropy.convolution.convolve returns nan values

python,numpy,astropy

Your kernel sums to zero and hence, astropy will raise the warning RuntimeWarning: invalid value encountered in true_divide kernel_internal /= kernel_sum which eventually leads to all the nans....

How to read in IRAF multispec spectra?

python,spectrum,astropy

I have been using this code, which was given to me by Rick White. However, the specutils package is probably the better way to do it: from specutils.io import read_fits spectra_list = read_fits.read_fits_spectrum1d('mymultispec.fits') print spectra_list[0] Spectrum1D([ 338.06109619, 395.59234619, 326.0012207 , ..., 660.0098877 , 686.54498291, 689.58374023]) print spectra_list[1].dispersion <Quantity [ 8293.44875263,...

make subplots from an astronomical fits image

python,astropy,aplpy

According to the APLpy documentation, you can make subplots: By default, FITSFigure creates a figure with a single subplot that occupies the entire figure. However, APLpy can be used to place a subplot in an existing matplotlib figure instance. To do this, FITSFigure should be called with the figure= argument...

Astropy Units equivalencies - interferometry baselines

python,astronomy,astropy

What you have currently works but you can actually simplify it a little. In particular, if astropy.units already knows how to convert e.g. s to ns then you don't need to define both m to s and m to ns, it will be able to figure it out. To simplify...

Giving labels to BinTableHDU data in astropy.io.fits

fits,astropy

Yes, you can do this by simply setting the name attribute on HDU objects, e.g: In [9]: hdulist[1].name = "Camelot" In [10]: hdulist.info() Filename: (No file associated with this HDUList) No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 4 () 1 CAMELOT ImageHDU 6 () ...

Why no good speedup for Astropy parallel testing with pytest-xdist?

py.test,parallel-testing,astropy

I would suspect the SSD is the limiting factor there. Many of the tests are CPU bound, but just as many make heavy disk usage--temp files and the like. Those could perhaps be made even slower by running in parallel. Beyond that it's hard to say much since it depends...

How to change the color of the circular region from green to red in ds9 through python using pyds9

python,astronomy,astropy,ds9

[Apparently, I'm not permitted to add comments to the previous answer, so here is another answer that goes with the above]. We looked into this, and the region "command" syntax appears to have a bug in it. Instead, you should use canonical xpa syntax, in which you pass the string...

astlib coordinates code to astropy coordinates code

python,coordinates,coords,astropy

This is one way to do it: In [1]: import numpy as np In [2]: from astropy import units as u In [3]: from astropy.coordinates import SkyCoord, FK4, FK5, Galactic In [4]: clra = np.zeros(3) In [5]: cldec = np.zeros(3) In [6]: c1 = SkyCoord(clra * u.deg, cldec * u.deg,...

Python 3 can only import astropy in some folders

python,python-3.x,astropy

This is a known issue: https://github.com/astropy/astropy/issues/3475 It will happen if you happen to be in an empty git repository (or your git is otherwise broken). There should be a new release out soon with a workaround to this. Just to follow up, this issue should be resolved in Astropy v0.4.5:...

Spectal plotting within Python?

python,plot,astronomy,astropy

In matplotlib, which is the most commonly used package for plotting spectra, you can use the drawstyle='steps-mid' option. See http://matplotlib.org/api/axes_api.html?highlight=plot#matplotlib.axes.Axes.plot for details. This question is asked and answered in detail here: http://www.astrobetter.com/blog/2012/01/27/pretty-plotting-of-spectra-ask-astrobetter/...

using python to pick out morphology of different pieces on an object in an image

python,image-processing,morphological-analysis,mathematical-morphology,astropy

If i have understood the problem right you would like to keep the blobs while removing the long strands that pass around or through the object. The simplest test i would suggest is using a simple morphological opening (erode and then dilate) that has a radius larger than the thickness...

How do you convert from AltAz coordinates to equatorial coordinates in Astropy

python,coordinates,astropy

I don't know much about astronomy, but it seems like there's plenty of documentation: transforming between coordinates full API docs for coordinates For me, cAltAz.icrs works and returns the original c. I needed to tweak a bunch of stuff to make it work on newAltAzcoordiantes (need to define x, stop...

astropy.io.fits - HIERARCH keywords don't work with CONTINUE cards: Bug or “Feature” of the FITS standard?

python,fits,astropy,pyfits

I wrote this in the issue opened by the OP, but I'm copying a version of it here too as a possible answer: The issue here is that the CONTINUE convention is strictly limited to extending the value of cards with string values (i.e. it does not apply to cards...