lsst / rubin_sim

Scheduler, survey strategy analysis, and other simulation tools for Rubin Observatory.
https://rubin-sim.lsst.io
GNU General Public License v3.0
41 stars 37 forks source link

Error calling bandpass.sbTophi() #283

Closed sylvielsstfr closed 1 year ago

sylvielsstfr commented 1 year ago

Probably there is a bad function name call in bandpass.sbTophi(). I am running master branch of rubin_sim.

I don't understand why this error is not triggered when calling it form the rubin_sim_notebook here https://github.com/lsst/rubin_sim_notebooks/blob/main/photometry/calculating_snr.ipynb

My passband is slightly different from the standard one in this calculating_snr.ipynb notebook. This is probably easy to fix it. Many thanks.

/Users/dagoret/anaconda3/lib/python3.9/site-packages/rubin_sim-1.0.5.dev4+gb6408b1-py3.9.egg/rubin_sim/photUtils/Sed.py:870: UserWarning: There is an area of non-overlap between desired wavelength range (300.00 to 1100.00)and sed FromArray (300.00 to 1099.90) warnings.warn(


AttributeError Traceback (most recent call last) Cell In[74], line 4 2 darksky_mags = {} 3 for index,f in enumerate(filter_tagnames): ----> 4 darksky_mags[f] = darksel.calcMag(pc.bandpass_inst[f]) 5 pd.DataFrame(darksky_mags, index=['Dark sky magnitudes']).round(2)

File ~/anaconda3/lib/python3.9/site-packages/rubin_sim-1.0.5.dev4+gb6408b1-py3.9.egg/rubin_sim/photUtils/Sed.py:1454, in Sed.calcMag(self, bandpass, wavelen, fnu) 1445 def calcMag(self, bandpass, wavelen=None, fnu=None): 1446 """ 1447 Calculate the AB magnitude of an object using the normalized system response (phi from Section 1448 4.1 of the LSST design document LSE-180). (...) 1452 (but only temporary values of these are used). 1453 """ -> 1454 flux = self.calcFlux(bandpass, wavelen=wavelen, fnu=fnu) 1455 if flux < 1e-300: 1456 raise Exception("This SED has no flux within this bandpass.")

File ~/anaconda3/lib/python3.9/site-packages/rubin_sim-1.0.5.dev4+gb6408b1-py3.9.egg/rubin_sim/photUtils/Sed.py:1439, in Sed.calcFlux(self, bandpass, wavelen, fnu) 1437 # Calculate bandpass phi value if required. 1438 if bandpass.phi is None: -> 1439 bandpass.sbTophi() 1440 # Calculate flux in bandpass and return this value. 1441 dlambda = wavelen[1] - wavelen[0]

AttributeError: 'Bandpass' object has no attribute 'sbTophi'

rhiannonlynne commented 1 year ago

I'm a little confused. If you're running on master of rubin_sim, there should be no property Sed.calcMag either.
It looks like you have a weird mix of post v1.0 and pre-v1.0 that I don't know how it came to be (i.e. there is no Sed.calcMag post v1.0 but there is pre-v1.0 .. and there is no sbTophi post1.0 but there is pre v1.0). If you're running from master of rubin_sim, is it possible that you have also somewhere an old copy of rubin_sim? or the Sed class?

I think you could try just deleting your entire rubin_sim package, recloning it and then redoing 'pip install -e .'.

sylvielsstfr commented 1 year ago

Many thanks, I think my environnement has several version of rubin_sim. I need to clear this. Many thanks;