mpound / pdrtpy

PhotoDissociation Region Toolbox Python module
GNU General Public License v3.0
6 stars 3 forks source link

NAXIS not found for added model from Measurement arithmetic #93

Open mpound opened 9 months ago

mpound commented 9 months ago
  1. When creating a new ratio that is not supported by default support by the model, as in the following example:

    x = ms.get_model("CI_609")

    y = ms.get_model("CO_43")

    z = y/x

    ms.add_model("CO_43/CI_609",model=z,title="CO(J=4-3)[C I] 609$\mu$m",overwrite=True)

    mylines =["CI_609","CI_370","CO_43"]

    ms.table.show_in_notebook()

    mylines =["CI_609","CI_370","CO_43"]

    check supported combinations of lines and ratios in the selected model

    mods = ms.get_models(mylines,model_type='both')

    mods.keys()

    plotting selected model

    z = ms.get_models(["CI_609","CI_370","CO_43"],model_type="ratio")

    print("Found models: ",z.keys())

    for j in z:

        pl_name = j
    
        pl_name = pl_name.replace("/", "_" ) 
    
        print(pl_name)
    
        mp.plot(j,legend=False,contours=True,label=True,yaxis_unit="Draine",cmap='rainbow',norm='zscale') # tab20c

I get the following error:


Exception Traceback (most recent call last)

Cell In[75], line 13

 11 pl_name = pl_name.replace("/", "_" ) 

 12 print(pl_name)

---> 13 mp.plot(j,legend=False,contours=True,label=True,yaxis_unit="Draine",cmap='rainbow',norm='zscale') # tab20c

 14 plt.savefig('/Users/cassaca-pgarcia/Desktop/'+str(pl_name)+'_latex.pdf', bbox_inches='tight',transparent=False)

File ~/anaconda3/lib/python3.10/site-packages/pdrtpy/plot/modelplot.py:45, in ModelPlot.plot(self, identifier, **kwargs)

 43 kwargs_opts.update(kwargs)

 44 if '/' in identifier:

---> 45 self.ratio(identifier,**kwargs_opts)

 46 else:

 47     self.intensity(identifier,**kwargs_opts)

File ~/anaconda3/lib/python3.10/site-packages/pdrtpy/plot/modelplot.py:76, in ModelPlot.ratio(self, identifier, **kwargs)

 73 if not kwargs_opts['image'] and kwargs_opts['colors'][0] == 'white':

 74     kwargs_opts['colors'][0] = 'black'

---> 76 self._plot_no_wcs(model,**kwargs_opts)

 77 if kwargs_opts['legend']:

 78     lines = list()

File ~/anaconda3/lib/python3.10/site-packages/pdrtpy/plot/modelplot.py:683, in ModelPlot._plot_no_wcs(self, data, header, **kwargs)

678 #if self._tool is not None:

679 #     if self._tool._modelnaxis is None and "NAXIS" not in _header:

680 #         raise Exception("Image header/WCS has no NAXIS keyword")

682 if "NAXIS" not in _header:

--> 683 raise Exception("Image header/WCS has no NAXIS keyword")

684 else:

685     _naxis = _header["NAXIS"]

Exception: Image header/WCS has no NAXIS keyword