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
14
votes
2 answers

How to plot Gaia astrometry data to TESS images

Long story short: I want to plot Gaia astrometry data to TESS imagery in Python. How is it possible? See below for elaborated version. I have 64x64 pixel TESS imagery of a star with Gaia ID 4687500098271761792. Page 8 of the TESS Observatory Guide…
zabop
  • 6,750
  • 3
  • 39
  • 84
12
votes
2 answers

Construct pandas dataframe from a .fits file

I have a .fits file that contains data. I would like to construct a pandas dataframe from this particular file but I don't know how to do it. data = fits.open('datafile') data.info gives: No. Name Type Cards Dimensions …
user2867798
9
votes
1 answer

Artifacts in convolution

I am using a direct convolution algorithm to compute the convolution between this image: and this kernel: I am using the implementation in astropy for the direct convolution. This results in the following convolution, leaving all settings…
user1991
  • 584
  • 1
  • 4
  • 18
8
votes
1 answer

Astropy matplotlib and plot galactic coordinates

I am trying to make a plot of galactic coordinates using python. Let's say that I have this data: data = [(0.261, -7.123, 13.03, 'Unidentified'), (-0.326, 77, 13.03, 'Galaxies')] Where each tuple is of the form (ra, dec, flux, type). I am asked to…
dpalma
  • 500
  • 5
  • 20
8
votes
1 answer

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

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…
Benjamin Rose
  • 165
  • 1
  • 2
  • 6
7
votes
3 answers

How to encircle some pixels on a heat map with a continuous, not branched line using Python?

I am using plt.imshow() to plot values on a grid (CCD data in my case). An example plot: I need to indicate a barrier on it, to show which pixels I care about. This is similar to what I need: I know how to add squares to an image, gridlines to an…
zabop
  • 6,750
  • 3
  • 39
  • 84
7
votes
1 answer

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

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…
7
votes
2 answers

WCS as matplotlib projection for a data-cube slice loaded using astropy?

I have a FITS file named 'my_cube.fits' with WCS. The file has spatial information on axis 1 and 2 (X and Y) and spectral information on axis 3 (Z). When I load it using astropy.io.fits, the spectral axis is 0 and spatial axes are 1 and 2. The file…
Bruno Quint
  • 111
  • 1
  • 7
7
votes
1 answer

Smoothing my heatmap in Python

I am developing a script in order to make heatmap from a sky survey with python and the libraries numpy, astropy. I created a stars distribution map and now I'm trying to make a heatmap. My heatmap is done and works well, but my next step is to…
user6051274
7
votes
2 answers

Is there a sunset/sunrise function built into Astropy yet?

I have seen a couple of answers referring to PyEphem on here and how that can produce sunset/sunrise times, however it would be more useful to me if I could find a solution using solely Astropy packages. At the moment the closest I have found is the…
Dean
  • 259
  • 3
  • 10
7
votes
1 answer

How can I get the value of a in Python

I am new to Python and using Python 2.7 on Windows I am using Astropy library, but when I want to view an attribute on the following class: >>> astropy.cosmology.FlatLambdaCDM.Ok0 it returns: Same for other…
Sibte Raza
  • 187
  • 1
  • 3
  • 7
7
votes
1 answer

Cartesian projection issue in a FITS image through PyFITS / AstroPy

I've looked and looked for a solution to this problem and am turning up nothing. I'm generating rectangular FITS images through matplotlib and subsequently applying WCS coordinates to them using AstroPy (or PyFITS). My images are in galactic…
Teachey
  • 549
  • 7
  • 18
6
votes
1 answer

Using AstroPy with matplotlib, I get a warning to call grid(False) first due to use of plt.colorbar()

Trying to run this code from AstroPy:docs import matplotlib.pyplot as plt from astropy.visualization import astropy_mpl_style plt.style.use(astropy_mpl_style) from astropy.utils.data import get_pkg_data_filename from…
jkeyes99
  • 61
  • 1
  • 3
6
votes
1 answer

Tying parameters in astropy.modeling

I am trying to use the Model.tied (or Parameter.tied) attribute in astropy.modelling, but can't seem to figure out how it works. For example, let's say I wanted to create a compound model with two parameters: flux_0 and flux_1. However, I only…
Benjamin
  • 690
  • 1
  • 7
  • 14
6
votes
1 answer

Always display entire tick labels on wcs axes

I'm reading data in from a FITS file and plotting a velocity field. I'm using set_major_formatter('dd:mm') for the angle on the y-axis, but for every other tick it's only displaying the minutes. I want the full degrees and minutes to show up for…
1
2 3
48 49