keflavich / cube-line-extractor

4 stars 1 forks source link

CubeLineMoment does not handle one transition input #14

Closed jmangum closed 5 years ago

jmangum commented 5 years ago

When I run CubeLineMoment with the attached yaml file (which specifies a single transition to extract), I get the following output:

In [6]: run CubeLineMoment.py 086600-onetransexample.yaml
/Users/jmangum/Science/ALCHEMI/Eisner/Analysis/cubes/CubeLineMoment.py:662: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  params = yaml.load(fh)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/Science/ALCHEMI/Eisner/Analysis/cubes/CubeLineMoment.py in <module>
    744
    745 if __name__ == "__main__":
--> 746     new_locals = main()
    747     locals().update(new_locals)
    748

~/Science/ALCHEMI/Eisner/Analysis/cubes/CubeLineMoment.py in main()
    680     if 'width_cut_scaling' in params and hasattr(params['width_cut_scaling'], 'split'):
    681         params['width_cut_scaling'] = list(map(float, params['width_cut_scaling'].split(", ")))
--> 682     params['my_line_list'] = u.Quantity(list(map(float, params['my_line_list'].split(", "))), u.GHz)
    683     params['my_line_widths'] = u.Quantity(list(map(float, params['my_line_widths'].split(", "))), u.km/u.s)
    684     params['my_line_names'] = params['my_line_names'].split(", ")

AttributeError: 'float' object has no attribute 'split'

086600-onetransexample.yaml.txt

keflavich commented 5 years ago

Try adding a comma after the line freq name in the yaml file... if that works, we just note that as the required syntax, otherwise we work around it...

jmangum commented 5 years ago

Adding the comma after the single entry for the name did not fix it. Same error:

In [3]: run CubeLineMoment.py 086600-onetransexample.yaml
/Users/jmangum/Science/ALCHEMI/Eisner/Analysis/cubes/CubeLineMoment.py:662: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  params = yaml.load(fh)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/Science/ALCHEMI/Eisner/Analysis/cubes/CubeLineMoment.py in <module>
    744
    745 if __name__ == "__main__":
--> 746     new_locals = main()
    747     locals().update(new_locals)
    748

~/Science/ALCHEMI/Eisner/Analysis/cubes/CubeLineMoment.py in main()
    680     if 'width_cut_scaling' in params and hasattr(params['width_cut_scaling'], 'split'):
    681         params['width_cut_scaling'] = list(map(float, params['width_cut_scaling'].split(", ")))
--> 682     params['my_line_list'] = u.Quantity(list(map(float, params['my_line_list'].split(", "))), u.GHz)
    683     params['my_line_widths'] = u.Quantity(list(map(float, params['my_line_widths'].split(", "))), u.km/u.s)
    684     params['my_line_names'] = params['my_line_names'].split(", ")

AttributeError: 'float' object has no attribute 'split'
keflavich commented 5 years ago

ok, I'll find some workaround.

When you post code, surroudn the code blocks with triple-backticks

keflavich commented 5 years ago

closed by 9817859