HeloiseS / hoki

Bridging the gap between observation and theory
https://heloises.github.io/hoki/intro.html
BSD 3-Clause "New" or "Revised" License
47 stars 8 forks source link

AttributeError: 'CMD' object has no attribute 'filter1' #4

Closed KshitijAggarwal closed 4 years ago

KshitijAggarwal commented 4 years ago

When running "Loading a pickled CMD file" in Colour Magnitude Diagrams.ipynb (for the JOSS review) and plotting the pickled_cmd object, like so:

pickled_cmd = unpickle(path='./data/cmds/cmd_bv_z020_bin_imf135_300')
plt.figure(figsize=(8,6))
myplot = pickled_cmd.plot(log_age=6.8)
myplot.set_xlabel('B-V', fontsize=14)
myplot.set_ylabel('V', fontsize=14)
myplot.set_xlim([-1,2.0])
myplot.set_ylim([2,-10])

I get the following error.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-d0a7f5d108fd> in <module>
      1 plt.figure(figsize=(8,6))
      2 
----> 3 myplot = pickled_cmd.plot(log_age=6.8)
      4 myplot.set_xlabel('B-V', fontsize=14)
      5 myplot.set_ylabel('V', fontsize=14)

~/.local/lib/python3.7/site-packages/hoki/cmd.py in plot(self, log_age, loc, cmap, **kwargs)
    336         cm_diagram.invert_yaxis()
    337 
--> 338         cm_diagram.set_ylabel(self.filter1)
    339         cm_diagram.set_xlabel(self.filter1+"-"+self.filter2)
    340 

AttributeError: 'CMD' object has no attribute 'filter1'
HeloiseS commented 4 years ago

Thanks for spotting this!

The problem here was with the data I provided - the pickle files needed updating!

It should all work now.