cylammarco / ASPIRED

Automated SpectroPhotometric Image REDuction (ASPIRED)
https://aspired.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
30 stars 4 forks source link

'Calibrator' object has no attribute 'add_user_atlas' #63

Closed rjs3273 closed 3 years ago

rjs3273 commented 3 years ago

I had this error before and I think you fixed it by telling me to update rascal.

target1D = spectral_reduction.OneDSpec()
target1D.from_twodspec(target2D, stype='science')    
atlas = [4501.0, 4524.7, 4582.8, 4624.28, 4671.23, 4807.02, 7802.65, 7887.40, 7967.34]
element = ['Xe'] * len(atlas)
target1D.add_user_atlas(elements=element, wavelengths=atlas, stype='science')

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-22-fc68e5f68e2b> in <module>
     22 element = ['Xe'] * len(atlas)
     23 
---> 24 target1D.add_user_atlas(elements=element, wavelengths=atlas, stype='science')

~/miniconda3/envs/astroconda/lib/python3.6/site-packages/aspired/onedspec.py in add_user_atlas(self, elements, wavelengths, spec_id, intensities, candidate_tolerance, constrain_poly, vacuum, pressure, temperature, relative_humidity, stype)
   2108                     pressure=pressure,
   2109                     temperature=temperature,
-> 2110                     relative_humidity=relative_humidity)
   2111                 self.logger.info(
   2112                     'Added user supplied atlas to '

~/miniconda3/envs/astroconda/lib/python3.6/site-packages/aspired/wavelength_calibration.py in add_user_atlas(self, elements, wavelengths, intensities, candidate_tolerance, constrain_poly, vacuum, pressure, temperature, relative_humidity)
    735         '''
    736 
--> 737         self.spectrum1D.calibrator.add_user_atlas(
    738             elements=elements,
    739             wavelengths=wavelengths,

AttributeError: 'Calibrator' object has no attribute 'add_user_atlas'

I have uninstalled and reinstalled the @dev branch of rascal and still getting this error.

cylammarco commented 3 years ago

I believe @jveitchmichaelis deleted the entire function by mistake in the dev...

@rjs3273 Please use pip install rascal. The v0.3 should work.

jveitchmichaelis commented 3 years ago

If you're running on rascal:dev, I moved this functionality to the Atlas class - you need to make an Atlas object and add the user lines to it (see examples)

On Sat, Sep 18, 2021, 12:59 Marco @.***> wrote:

I believe @jveitchmichaelis https://github.com/jveitchmichaelis deleted the entire function by mistake in the dev...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cylammarco/ASPIRED/issues/63#issuecomment-922151086, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDMJ44KHXO4OOM2O7ZYILUCPQAVANCNFSM5EDMT6KA .

cylammarco commented 3 years ago

@rjs3273 Please see https://github.com/jveitchmichaelis/rascal/blob/dev/examples/example_lt_sprat_xe.py#L40-L50

for the new atlas setting for the future v0.4 release.

Or use pip install rascal for v0.3.

@jveitchmichaelis Is there a timeline for the v0.4?

jveitchmichaelis commented 3 years ago

Hmm we could add a legacy option to the dev api and let's assume we'll phase it out for 0.4.0?

cylammarco commented 3 years ago

OK

rjs3273 commented 3 years ago

Thanks, chaps. I can confirm I am running fine with rascal v.0.3 installed. In the longer run, should I stop using aspired.OneDSpec.add_user_atlas() or is it staying?

cylammarco commented 3 years ago

It is possible for aspired to support it indefinitely, and I think that should be the case. I will have a closer look when rascal v0.4 and its future plan has become clearer.