Questions tagged [astropy]

Questions related to Astropy, a community Python package for Astronomy

The Astropy Project is a community effort to develop a common core package for Astronomy in Python and foster interoperability between Python astronomy packages.

This package provides core data structure and transformations adapted to astronomy, files and I/O tools, as well as computation utilities.

For more information, refer to the Astropy documentation.

When you are posting questions about astropy, it is helpful to include the sample data file(s). Since FITS files are large, linking to publicly available MAST data, or a GitHub repo, are the best options.

730 questions
4
votes
1 answer

Plot a FITS image over a grid of the entire sky

I would like to plot a FITS image over a sketch of the entire sky. I got this far in plotting the entire sky: import matplotlib.pyplot as plt from astropy.utils.data import get_pkg_data_filename from astropy.io import fits image_file =…
usernumber
  • 1,958
  • 1
  • 21
  • 58
4
votes
0 answers

Changing Astropy WCS projection

I use the below python script to read the world coordinate system (WCS) form a fits file and plot it. from astropy.io import fits import matplotlib.pyplot as plt from astropy.wcs import WCS hdu = fits.open('file.fits') header = hdu[0].header data =…
Mc Missile
  • 715
  • 11
  • 25
4
votes
2 answers

Incorrect pylint errors on astropy in VScode (?)

I'm using astropy's units and EartLocation to set my observatory location. Hardcoded for now. However, when I run the code in VScode pylint is bugging me with errors whereas the code runs fine when I run it in PyCharm and IDLE. Code: obsy_location =…
theritz
  • 41
  • 5
4
votes
1 answer

Astropy, Numpy: Applying function over coordinates is very slow

I have a large collection of coordinates contained within a single astropy coordinate object. I would like to apply a function to each coordinate in parallel and produce an output array of the same shape—but this is slow. (In my case, the function…
Jollywatt
  • 1,382
  • 2
  • 12
  • 31
4
votes
3 answers

How to convert J2000 time to UTC in python?

I have time in J2000 format, ie. seconds after noon on 1-1-2000, which I want to convert to UTC time in an array with the format [year-month-day hour:min:sec.millisec]. Is there some function in AstroPy or something similar to do the…
Rose
  • 279
  • 1
  • 7
  • 20
4
votes
2 answers

Astroquery SIMBAD : Obtaining coordinates for all frames

I'm trying to obtain coordinates for all frames using the Simbad class from astroquery, just like it is shown on the SIMBAD web page (Basic data section) I have the following code : from astroquery.simbad import Simbad def get(): …
civa
  • 459
  • 3
  • 12
4
votes
2 answers

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

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…
AshleyNova
  • 55
  • 4
4
votes
2 answers

Numpy log10 function: AttributeError: 'float' object has no attribute 'log10'

import numpy as np import astropy as ap def mass(FWHM, lumi): abs_lumi = bhm.L_1450(lumi) s1 = (FWHM/1000) s2 = ((abs_lumi)/(10**44)) s = [(s1**2)*(s2**0.53)] #mass = np.log10((s1**2)*(s2**0.53)) + 6.66 #old way, didn't work …
Kaila
  • 63
  • 1
  • 1
  • 5
4
votes
1 answer

Filter astropy table by the values in a given column

I have an astropy table that looks like this: $ print(astro_table) id xcentroid ycentroid sharpness roundness1 ... npix sky peak flux mag ---- ------------- ------------- --------------…
Gabriel
  • 40,504
  • 73
  • 230
  • 404
4
votes
2 answers

How do I save the header and units of an astropy Table into an ascii file

I'm trying to create an ascii table with some information on the header, the names and units of the columns and some data, it should look like this: # ... Header Info ... Name | Morphology | ra_u | dec_u | ... …
Emberck
  • 55
  • 8
4
votes
1 answer

Can PyEphem be used to calculate set and rise times for any object?

Is there a way to use PyEphem to calculate rise/set values for a list of targets? I have an astropy.tableof coordinates (in RA & Dec) for my targets and I would like to use PyEphem (or another package) to produce a further two columns with Rise &…
Dean
  • 259
  • 3
  • 10
4
votes
2 answers

Perform coordinates projection with astropy

I have a set of points in equatorial coordinates and I need to project them onto a plane, ie: a zenithal or azimuthal projection. astropy is apparently able to perform this type of projection, among many others. The problem is that I don't know how…
Gabriel
  • 40,504
  • 73
  • 230
  • 404
4
votes
1 answer

Astropy: Inititializing a user-defined Coordinate Frame

I am developing an application for Raspberry Pi to control an amateur telescope on AltAzimutal mount. The azimutal axis is not perfectly aligned with the zenith. In this case one can point onto 2 or 3 stars and find the transformation matrix between…
MaksymMO
  • 45
  • 5
4
votes
2 answers

Radial Profile from a .fits image

I have been trying to plot a radial profile of a fits image using a modified script I found on-line. I always get y axis units which are completely different to what's expected. I'm not even sure what the y axis units are. I have attached the fits…
BubbleGum
  • 53
  • 1
  • 4
4
votes
1 answer

Boxcar convolve a scatter plot in python/astropy?

I believe the fix to this will be relatively simple, but I can't seem to figure out how to convolve a scatter plot that I've plotted in python. I have 2 data arrays, one of galactic latitudes and one of galactic longitudes, and I've plotted them…
P Abb
  • 41
  • 3
1 2
3
48 49