Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load analysis results from table model #34

Closed
grburgess opened this issue Feb 21, 2017 · 1 comment
Closed

load analysis results from table model #34

grburgess opened this issue Feb 21, 2017 · 1 comment

Comments

@grburgess
Copy link
Contributor

I'm attempting to load analysis results saved to disk from a fit with a template model.

I get the following error:

---------------------------------------------------------------------------
ModelSyntaxError                          Traceback (most recent call last)
<ipython-input-6-49c753aae90b> in <module>()
----> 1 load_analysis_results('test_fit.fit')

/Users/jburgess/coding/3ML/threeML/analysis_results.pyc in load_analysis_results(fits_file)
     61         if n_results == 1:
     62 
---> 63             return _load_one_results(f['ANALYSIS_RESULTS', 1])
     64 
     65         else:

/Users/jburgess/coding/3ML/threeML/analysis_results.pyc in _load_one_results(fits_extension)
     77     model_dict = my_yaml.load(serialized_model)
     78 
---> 79     optimized_model = ModelParser(model_dict=model_dict).get_model()
     80 
     81     # Gather statistics values

/Users/jburgess/.environs/3ml/lib/python2.7/site-packages/astromodels-0.3.0-py2.7-macosx-10.12-x86_64.egg/astromodels/core/model_parser.pyc in __init__(self, model_file, model_dict)
     83             self._model_dict = model_dict
     84 
---> 85         self._parse()
     86 
     87     def _parse(self):

/Users/jburgess/.environs/3ml/lib/python2.7/site-packages/astromodels-0.3.0-py2.7-macosx-10.12-x86_64.egg/astromodels/core/model_parser.pyc in _parse(self)
    125             else:
    126 
--> 127                 this_parser = SourceParser(source_or_var_name, source_or_var_definition)
    128 
    129                 res = this_parser.get_source()

/Users/jburgess/.environs/3ml/lib/python2.7/site-packages/astromodels-0.3.0-py2.7-macosx-10.12-x86_64.egg/astromodels/core/model_parser.pyc in __init__(self, source_name, source_definition)
    262         if source_type == POINT_SOURCE:
    263 
--> 264             self._parsed_source = self._parse_point_source(source_definition)
    265 
    266         elif source_type == EXTENDED_SOURCE:

/Users/jburgess/.environs/3ml/lib/python2.7/site-packages/astromodels-0.3.0-py2.7-macosx-10.12-x86_64.egg/astromodels/core/model_parser.pyc in _parse_point_source(self, pts_source_definition)
    337 
    338         for component_name, component_definition in pts_source_definition['spectrum'].iteritems():
--> 339             this_component = self._parse_spectral_component(component_name, component_definition)
    340 
    341             components.append(this_component)

/Users/jburgess/.environs/3ml/lib/python2.7/site-packages/astromodels-0.3.0-py2.7-macosx-10.12-x86_64.egg/astromodels/core/model_parser.pyc in _parse_spectral_component(self, component_name, component_definition)
    418         shape_parser = ShapeParser(self._source_name)
    419 
--> 420         shape = shape_parser.parse(component_name, function_name, parameters_definition)
    421 
    422         # Get the links and extra setups, if any

/Users/jburgess/.environs/3ml/lib/python2.7/site-packages/astromodels-0.3.0-py2.7-macosx-10.12-x86_64.egg/astromodels/core/model_parser.pyc in parse(self, component_name, function_name, parameters_definition)
    481     def parse(self, component_name, function_name, parameters_definition):
    482 
--> 483         return self._parse_shape_definition(component_name, function_name, parameters_definition)
    484 
    485     @staticmethod

/Users/jburgess/.environs/3ml/lib/python2.7/site-packages/astromodels-0.3.0-py2.7-macosx-10.12-x86_64.egg/astromodels/core/model_parser.pyc in _parse_shape_definition(self, component_name, function_name, parameters_definition)
    508 
    509                 raise ModelSyntaxError("Function %s, specified as shape for %s of source %s, is not a "
--> 510                                        "known function" % (function_name, component_name, self._source_name))
    511 
    512         # Loop over the parameters of the function instance, instead of the specification,

ModelSyntaxError: Function TemplateModel_synchrotron, specified as shape for main of source synch, is not a known function

I've attached the analysis results, but the template is too large, so I have stored it in dropbox: https://www.dropbox.com/s/l964mncqpm8vcm7/synchrotron.h5?dl=0

@grburgess
Copy link
Contributor Author

test_fit.fit.zip

giacomov added a commit that referenced this issue Mar 4, 2017
… long-standing problem of non-pickeable classes. Fix #33, #34, #23, #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants