aasensio / hazel2

Hazel v2.0: synthesis and inversion of Stokes profiles caused by the joint action of atomic level polarization and the Hanle and Zeeman effects

Home Page:https://aasensio.github.io/hazel2/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After last update Hazel crashed

Hypnus1803 opened this issue · comments

After I updated today the Hazel2 repository, I got an error and it is not possible to invert a single pixel.

TypeError                                 Traceback (most recent call last)
<ipython-input-8-e044df850698> in <module>
----> 1 mod = hazel.Model('conf_single.ini', working_mode='inversion', verbose=2)
      2 mod.read_observation()
      3 mod.open_output()
      4 mod.invert()
      5 mod.write_output()

~/anaconda3/lib/python3.7/site-packages/hazel-2018.9.22-py3.7-macosx-10.9-x86_64.egg/hazel/model.py in __init__(self, config, working_mode, verbose, debug, rank, randomization)
     78             self.configuration = Configuration(config)
     79 
---> 80             self.use_configuration(self.configuration.config_dict)
     81 
     82         # Initialize pyhazel

~/anaconda3/lib/python3.7/site-packages/hazel-2018.9.22-py3.7-macosx-10.9-x86_64.egg/hazel/model.py in use_configuration(self, config_dict)
    182                     self.logger.info('  - New available photosphere : {0}'.format(value['name']))
    183 
--> 184                 self.add_photosphere(value)
    185 
    186             if ('chromosphere' in key):

~/anaconda3/lib/python3.7/site-packages/hazel-2018.9.22-py3.7-macosx-10.9-x86_64.egg/hazel/model.py in add_photosphere(self, atmosphere)
    579                 raise FileExistsError("Input file {0} for atmosphere {1} does not exist.".format(my_file, atm['name']))
    580 
--> 581             self.atmospheres[atm['name']].load_reference_model(atm['reference atmospheric model'], self.verbose)
    582 
    583             if (self.atmospheres[atm['name']].model_type == '3d'):

~/anaconda3/lib/python3.7/site-packages/hazel-2018.9.22-py3.7-macosx-10.9-x86_64.egg/hazel/photosphere.py in load_reference_model(self, model_file, verbose)
    223         self.model_handler.close()
    224 
--> 225         self.set_parameters(out, ff, vmac)
    226 
    227         self.init_reference(check_borders=True)

~/anaconda3/lib/python3.7/site-packages/hazel-2018.9.22-py3.7-macosx-10.9-x86_64.egg/hazel/photosphere.py in set_parameters(self, model, ff, vmac)
    265         if (self.working_mode == 'inversion'):
    266             for k, v in self.parameters.items():
--> 267                 self.parameters[k] = np.clip(v, self.ranges[k][0] + 1e-8, self.ranges[k][1] - 1e-8)
    268 
    269 

TypeError: 'NoneType' object is not subscriptable

Yes, I have recently added the macroscopic velocity as a parameter in photosphere. You would need to add "vmac" in all photospheric models and add nodes and ranges for vmac in the configuration file.

You are right, I already changed it in the model, but not in the configuration file. Thanks