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
-1
votes
1 answer

Using a for loop for extracting a range of columns with astropy in python

I have the following file: rowname1 0.0019 0.0142 -0.0258 -0.0058 -0.0097 rowname2 0.0001 0.0168 -0.0268 -0.0063 -0.0072 and I would like to extract the columns from 2nd (i.e. avoiding the rownames…
Miguel
  • 356
  • 1
  • 15
-1
votes
1 answer

Why this code getting me error message?astropy: attribute error cannot import fitting

i want to use astropy for fitting spectra my code is: from astropy.io import fits from astropy.modeling import models, fitting import math import numpy as np import pylab as plb import matplotlib.pyplot as plt #after opening the fits file and…
sasha
  • 29
  • 5
-1
votes
1 answer

How do I remove blank elements from an AstroPy table?

I'm trying to remove any elements from an astropy table that have blank fields. However, all the help I have found so far just tells me how to replace it. I have tried replacing these blank fields (denoted by '--') with zeroes. However, whenever I…
-1
votes
1 answer

Problems with gridspec plotting with APLpy

So I'm attempting to plot to fits images (identical fits images) with some annotations provided by a DS9 region file using APLpy: My script is as follows: import aplpy import matplotlib import matplotlib.pyplot as pyplot import matplotlib.gridspec…
user3125347
-1
votes
1 answer

Specifying a large commented header using astropy.tables module

N.B. I'm using a combination of astropy's Table and ascii modules. I'm looking to include the following commented header above my table: #1 pxlname 1 #2 x 0 #3 y 0 #4 z 8 #5 Dist 9 #6…
user3125347
-1
votes
1 answer

astropy fits how many extentions?

Is there a way to see how many extensions your fits file has? So if my file looks like this for example, how can I get 309 back without opening every frame and blowing up my ram? Filename: a.fits No. Name Type Cards Dimensions …
Coolcrab
  • 2,655
  • 9
  • 39
  • 59
-1
votes
1 answer

build new table from rows in astropy

I am trying to cut out several selected objects in a astronomical catalog (FITS file) using the python package astropy. My question is how to cut out these objects and save them in a new catalog?
陈灵健
  • 13
  • 3
-1
votes
1 answer

Creating FITS file from a list of table data

I think I screwed something up when selecting data from a fits file...Basically what I did was: File='/SomePath/xxx.fits' hdulist=fits.open(File) tbdata=hdulist[1].data and applied a selection rule: for i in range (0, len(tbdata)): if…
Leo
  • 53
  • 1
  • 5
-1
votes
1 answer

Import astropy calling Python from PHP

I'd like to run a Python script from PHP (LAMP). The script imports astropy, and for some reason I am not able to successfully do that. I can reproduce the basic problem with the example files copied below. I don't think it is a permission or Python…
Ivan
  • 1
  • 1
-1
votes
1 answer

Error message when importing astropy in Windows 8

I have Windows 8 (sadly I was lucky enough to but a laptop that support very badly Linux, tried several distributions..). I have Python 2.7 installed, and also can import scipy and numpy. I've installed astropy with the executable file from their…
Ohm
  • 2,312
  • 4
  • 36
  • 75
-2
votes
1 answer

File "", line 1 syntax error python on linux

I'm trying to install an astro programm, PAHFits, the problem is that when I run it in the pyhton shell, it appears File "", line 1, as in the image I know it's not a problem with PAHFit but I don't know how to solve it! Help :( I tried to install…
-2
votes
1 answer

Using multiple FITS file

How can I open two fits file at the same time with astropy? Is it possible to work on multiple FITS file at the same time or do I have to work on one at a time?
-2
votes
1 answer

While Loop Issues - Python 3.6.4

I'm trying to write an azimuth/elevation calculator as an exercise to explore the astropy libraries. I'm quite new to Python and have run into trouble with a basic while loop within my programme: LATLONGALT = eci2lla(x,y,z,dt) lon_sub =…
Lorcank11
  • 137
  • 8
-2
votes
1 answer

Astropy.table Unique() not working

I'm having some problems with unique function after updating astropy code: from astropy.table import Table import numpy as np table = Table(data=[[1,2,3,2,3,3],[2,3,4,5,4,6],[3,4,5,6,7,8]], names=['col1', 'col2', 'col3'], dtype=[np.int32,…
-2
votes
1 answer

Pyfits or astropy.io.fits add row to binary table in fits file

How can I add a single row to binary table inside large fits file using pyfits, astropy.io.fits or maybe some other python library? This file is used as a log, so every second a single row will be added, eventually the size of the file will reach…
Vitalii
  • 77
  • 1
  • 6
1 2 3
48
49