astropy

How to read in IRAF multispec spectra?

折月煮酒 提交于 2021-02-20 18:53:45
问题 I have a spectrum in a fits file that I generated with Iraf. The wavelength axis is encoded in the header as: WAT0_001= 'system=multispec' WAT1_001= 'wtype=multispec label=Wavelength units=angstroms' WAT2_001= 'wtype=multispec spec1 = "1 1 2 1. 2.1919422441886 4200 0. 452.53 471' WAT3_001= 'wtype=linear' WAT2_002= '.60 1. 0. 3 3 1. 4200.00000000001 1313.88904209266 1365.65012876239 ' WAT2_003= '1422.67911152069 1479.0560707956 1535.24082980747 1584.94609332243' Is there an easy way to load

Opening Astropy FITS file from SFTP server

孤人 提交于 2021-02-08 03:30:23
问题 I have a Python script that ssh into a remote server using Paramiko module. The below is my script import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect("host", username="McMissile") A FITS file on a local machine is usually opened as follows: from astropy.io import fits hdu = fits.open('File.fits') I was wondering how would I open a FITS file from the SFTP server machine and store it under the variable hdu in the local machine. I

Sort out same star from Photutils DAOStarFinder Tables of multiple figures

橙三吉。 提交于 2021-01-29 19:55:20
问题 I have a series of .fit figures of the CCD telescope observation, I use DAOStarFinder in photutils to do the photometrys. I want to find out data of same stars and plot their light curves. The stars table obtained from one figure looks like: id xcentroid ycentroid sharpness roundness1 roundness2 npix sky peak flux mag JD-HELIO 1 7.2507764 7.1405824 0.25877792 -0.27655266 -0.014479976 361 0 422 12.624582 -2.7530425 2458718.4 2 2740.913 7.1539345 0.30025149 0.25451119 0.018093909 361 0 458 13

No module named astropy

那年仲夏 提交于 2021-01-29 10:38:11
问题 I've install the module Astropy for Python in mac using: pip install --user astropy It works when I installed but when I execute this code I have an error. import astropy astropy.test() This is the error Traceback (most recent call last): File "/Users/JanPolRoig/Documents/astropytest.py", line 1, in <module> import astropy ModuleNotFoundError: No module named 'astropy' Why is this happening? 回答1: With the Python executable you're using, try installing it as follows: python -m pip install -

AstroPy SkyCoord extremely slow, how to resovle it?

穿精又带淫゛_ 提交于 2021-01-28 23:34:24
问题 I am using AstroPy SkyCoord to do conversion from equatorial coordinates to galactic coordinates with millions data, it is extremely slow. Anyone has idea to speed it up, otherwise it takes forever to run the whole dataset. The code is below: from astropy import units as u from astropy.coordinates import SkyCoord import numpy as np ra1 = np.loadtxt('data.txt',usecols=(0,)) dec1 = np.loadtxt('data.txt',usecols=(1,)) size = len(ra1) for i in range(size): ra = ra1[i] dec = dec1[i] c = SkyCoord

Coordinate conversion problem of a FITS file

此生再无相见时 提交于 2020-12-31 05:44:16
问题 I have loaded and plotted a FITS file in python. With the help of a previous post, I have managed to get the conversion of the axis from pixels to celestial coordinates. But I can't manage to get them in milliarcseconds (mas) correctly. The code is the following import numpy as np import matplotlib.pyplot as plt import astropy.units as u from astropy.wcs import WCS from astropy.io import fits from astropy.utils.data import get_pkg_data_filename filename = get_pkg_data_filename('hallo.fits')

Coordinate conversion problem of a FITS file

穿精又带淫゛_ 提交于 2020-12-31 05:41:55
问题 I have loaded and plotted a FITS file in python. With the help of a previous post, I have managed to get the conversion of the axis from pixels to celestial coordinates. But I can't manage to get them in milliarcseconds (mas) correctly. The code is the following import numpy as np import matplotlib.pyplot as plt import astropy.units as u from astropy.wcs import WCS from astropy.io import fits from astropy.utils.data import get_pkg_data_filename filename = get_pkg_data_filename('hallo.fits')

why does it say “ValueError: The array returned by a function changed size between calls”?

流过昼夜 提交于 2020-11-30 01:43:25
问题 I'm trying to calculate an integral and I don't understand the error output, what does it mean, what's the problem and how do I fix it? the output is "ValueError: The array returned by a function changed size between calls", I added the full output. pleas help, thank you import numpy as np import matplotlib.pyplot as plt import astropy.cosmology as cosmo from astropy import units as u from astropy import constants as const import scipy.integrate as integrate from scipy.optimize import fsolve

why does it say “ValueError: The array returned by a function changed size between calls”?

安稳与你 提交于 2020-11-30 01:43:14
问题 I'm trying to calculate an integral and I don't understand the error output, what does it mean, what's the problem and how do I fix it? the output is "ValueError: The array returned by a function changed size between calls", I added the full output. pleas help, thank you import numpy as np import matplotlib.pyplot as plt import astropy.cosmology as cosmo from astropy import units as u from astropy import constants as const import scipy.integrate as integrate from scipy.optimize import fsolve

why does it say “ValueError: The array returned by a function changed size between calls”?

Deadly 提交于 2020-11-30 01:40:09
问题 I'm trying to calculate an integral and I don't understand the error output, what does it mean, what's the problem and how do I fix it? the output is "ValueError: The array returned by a function changed size between calls", I added the full output. pleas help, thank you import numpy as np import matplotlib.pyplot as plt import astropy.cosmology as cosmo from astropy import units as u from astropy import constants as const import scipy.integrate as integrate from scipy.optimize import fsolve