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

I keep receiving ModuleNotFoundError: No module named 'specreduce' when I try to import specreduce

I was following a tutorial, and I originally tried typing from specreduce.calibration_data import load_MAST_calspec, which gave the same error. I'm not sure how to properly import specreduce, so if anyone could show me how to do that I would be…
-1
votes
2 answers

Rename '.tbl' files in directory using string from the first line of file python

I have a directory filled with '.tbl' files. The file set up is as follows: \STAR_ID = "HD 74156" \DATA_CATEGORY = "Planet Radial Velocity Curve" \NUMBER_OF_POINTS =…
-1
votes
1 answer

How to get WGS84 axes out of astropy erfa

Astropy uses the WGS84 ellipsoid for it's astropy.coordinates.EarthLocation.to_geodetic() function. I'd like to make other calculations that are consistent with that function and for that, I'd like to see astropy's WGS84 representation. It seems…
-1
votes
1 answer

Facility to plot RA/DEC with error and energy

The question is purely on plotting trick, which helps to understand the data better. I have a data file with position (RA and DEC) of the source, error in RA/DEC and energy observed in the source. For example, RA || DEC || Ang_error || Energy 25.4…
Mohanraj S
  • 13
  • 3
-1
votes
1 answer

How to divide two data sets (spectra) with different sizes?

Spectrum_3 = Spectrum_1/Spectrum_2, but they have different sizes. How could I proceed? Since I am dealing with spectra, my approach is to decrease the resolution of Spectrum_1 so that the data size matches (if you come from Astrophysics is this a…
-1
votes
2 answers

ECEF frames in astropy/healpix?

I went through the astropy documentation and concluded that there are no native ECEF (earth-centered, earth-fixed) frames with lon, lat coordinates that can be converted into equatorial coordinates RA, dec if the time is given. Is this…
-1
votes
1 answer

How to determine number of distinct shapes on a picture?

Here I have an image of two objects/stars: I have hundreds of images like this one, from NASA MAST Archive. (The corners are not stars, just errors, one star is on the top, the other one is on the bottom). What algorithm should I use to determine…
zabop
  • 6,750
  • 3
  • 39
  • 84
-1
votes
1 answer

Use of astropy.visualization hist() function instead of matplotlib hist() function

Can someone show me how to replace matplotlib hist() function with hist() function from astropy.visualization module from the following code: Hist_SNR = plt.figure() Hist_SNR, ax = plt.subplots(3, 1, sharex=True) ax[0].hist(data1['SNR'], bins=10,…
Nikson
  • 67
  • 7
-1
votes
1 answer

Is something wrong with my fits file?

I am currently trying to display this fits image, but I keep running into different errors. At first it couldn't print the non-ASCII characters in the header so I went ahead and deleted them (they seemed like just blank spaces in the header, it…
-1
votes
2 answers

AttributeError: 'record' object has no attribute '_coldefs' when creating a BinTableHDU

An error showed up recently on a new system I am using when I want to create simple BinTableHDU with astropy. Here is the code I setup to isolate the problem : import astropy.io.fits as pyfits ar = numpy.array(range(100)) col =…
akira
  • 31
  • 6
-1
votes
1 answer

[WinError 32]The process cannot access the file because it is being used by another process:

I have code where I'm writing to a file, and the next time I run the code after the code successfully runs, it gives me the following error: PermissionError: [WinError 32] The process cannot access the file because it is being used by another…
-1
votes
2 answers

Picking out a single row in a FITS table with Astropy

I "simply" want to read in an (Astronomy) FITS table, and pick out all the information on one object via its name:: from astropy.io import fits dr7q = fits.open('Shen_dr7_bh_May_2010.fits') tbdata = dr7q[1].data w = tbdata[tbdata['SDSS_NAME'] ==…
npross
  • 1,756
  • 6
  • 19
  • 38
-1
votes
1 answer

Problems with FITS header

I've asked this on astronomy.se as well. I'm working with some NEOWISE images that seem to have incomplete header tags. I've been advised by the SAO (because I'm using DS9 to view them) that I have "a partial PC matrix defined, yet it does not…
Jim421616
  • 1,434
  • 3
  • 22
  • 47
-1
votes
1 answer

How do I sort data based on a pattern in Python?

I have a set of data (an Echelle diagram) i would like to sort out. Visually it's clear to see a pattern of two close set of points and a set further away. How do I split the three data sets from each other? I hope you can help me!
onitek
  • 17
  • 2
-1
votes
2 answers

How can I access the image data from a FITS file?

how can I access the image subsample from a FITS file? I could not tell where exactly the data is in the file! The file headers show that it's in the second header and that it is of dimension 1024*1024! But when I try to access the second header I…