Closed pziphi closed 6 years ago
I cannot reproduce the issue.
import pyphot
lib = pyphot.get_library()
f = lib['SDSS_r']
from pyphot.vega import Vega
vega = Vega()
f.get_flux(vega.wavelength, vega.flux)
f.get_flux(vega.wavelength.magnitude, vega.flux.magnitude)
Please provide more information.
tests above done with
np.__version__ = '1.14.5'
Thank you for a quick reply.
This code works fine for me too. When I checked the type of 'vega.wavelength' and 'vega.flux', I see that they are quantities:
vega.wavelength
<Quantity([9.00452026e+02 9.01354004e+02 9.02257996e+02 ... 2.99353200e+06 2.99653275e+06 2.99953700e+06], 'angstrom')>
vega.flux
<Quantity([1.23800003e-17 1.67599994e-17 1.78000003e-17 ... 1.40099994e-19
1.38700004e-19 1.26499994e-19], 'flam')>
When I rechecked my inputs: 'lamb' and 'spectra', I realized that they are lists (not arrays).
So, I assume the issue is with my input data type.
I have this ascii file containing the wavelength, flux and error values. What I did was, I created two lists: 'lamb' and 'spectra' from this file where 'lamb' contains wavelength data and 'spectra' contains flux data. Could you please help me by letting me know the right way to proceed? Also, where do I incorporate the units?
You can use numpy arrays instead of lists and that will work with a unit warning.
The only necessary unit is on the wavelength (the code does not handle flux units yet).
A simple multiplication between your array and the unit object is enough. (very similar to astropy units)
from pyphot import unit
wave_unit = wave * unit['nm']
Hi,
I was trying to use PyPhot to do synthetic photometry for a star, for which I have the calibrated spectra. The wavelength values are stored in the array: lamb and the calibrated flux values are stored in the array spectra. I was following the quick start guide given in the documentation and the code gives me the error: TypeError: only integer scalar arrays can be converted to a scalar index
When searched online I saw that the issue appears to be related to the latest version of NumPy. The version of NumPy that I am using is 1.14.5.
Can anyone suggest me a fix, please?