It seems the various ScattererSE derived models do not specify the names for their parameters, which makes it very hard to read the output when printing out the structure's parameters as there are many parameters that are just named ''.
As an example, I think just adding this to __init__ for class TaucLorentz mostly fixes the problem.
self.Am.name = 'Am'
self.C.name = 'C'
self.En.name = 'En'
self.Einf.name = 'Einf'
self.Eg.name = 'Eg'
For TaucLorentz, at least, this still leaves the sequence_to_parameters individual Parameter objects without names, but the Parameters groups is at least named something besides None. As a futher improvement, the sub-Parameters can be indented relative to their parent, though that requires modifying the refnx/parameter.py code.
For example, with this code instead of the current in class Parameters:
def __str__(self):
return self._print()
def _print(self,indent=1):
s = list()
s.append(f"{'':_>80}")
s.append(' '*(indent-1) + f"Parameters: {self.name!r: ^15}")
for el in self._pprint(indent+1):
s.append(' '*indent + el)
return "\n".join(list(flatten(s)))
def _pprint(self,indent):
for el in self.data:
if is_parameters(el):
yield el._print(indent)
else:
yield str(el)
the output looks like
________________________________________________________________________________
Structure:
solvent: None
reverse structure: False
contract: 0
________________________________________________________________________________
Parameters: 'Air'
<Parameter: ' - thick' , value=0 (fixed) , bounds=[-inf, inf]>
<Parameter: ' - rough' , value=0 (fixed) , bounds=[-inf, inf]>
<Parameter:' - volfrac solvent', value=0 (fixed) , bounds=[0.0, 1.0]>
________________________________________________________________________________
Parameters: 'Layer'
<Parameter:'TaucLorentz - thick', value=180 , bounds=[150.0, 210.0]>
________________________________________________________________________________
Parameters: 'Am'
<Parameter: '' , value=100 (fixed) , bounds=[-inf, inf]>
<Parameter: '' , value=10 (fixed) , bounds=[-inf, inf]>
________________________________________________________________________________
Parameters: 'C'
<Parameter: '' , value=1 (fixed) , bounds=[-inf, inf]>
<Parameter: '' , value=2 (fixed) , bounds=[-inf, inf]>
________________________________________________________________________________
Parameters: 'En'
<Parameter: '' , value=6 (fixed) , bounds=[-inf, inf]>
<Parameter: '' , value=7 (fixed) , bounds=[-inf, inf]>
<Parameter: 'Einf' , value=3 (fixed) , bounds=[-inf, inf]>
<Parameter: 'Eg' , value=5.5198 (fixed) , bounds=[-inf, inf]>
<Parameter:'TaucLorentz - rough', value=0 (fixed) , bounds=[-inf, inf]>
<Parameter:'TaucLorentz - volfrac solvent', value=0 (fixed) , bounds=[0.0, 1.0]>
________________________________________________________________________________
Parameters: 'Si Substrate'
<Parameter: ' - thick' , value=0 (fixed) , bounds=[-inf, inf]>
<Parameter: ' - rough' , value=0 (fixed) , bounds=[-inf, inf]>
<Parameter:' - volfrac solvent', value=0 (fixed) , bounds=[0.0, 1.0]>
It seems the various ScattererSE derived models do not specify the names for their parameters, which makes it very hard to read the output when printing out the structure's parameters as there are many parameters that are just named
''.As an example, I think just adding this to
__init__forclass TaucLorentzmostly fixes the problem.For TaucLorentz, at least, this still leaves the
sequence_to_parametersindividual Parameter objects without names, but the Parameters groups is at least named something besidesNone. As a futher improvement, the sub-Parameters can be indented relative to their parent, though that requires modifying the refnx/parameter.py code.For example, with this code instead of the current in
class Parameters:the output looks like
________________________________________________________________________________ Structure: solvent: None reverse structure: False contract: 0 ________________________________________________________________________________ Parameters: 'Air' <Parameter: ' - thick' , value=0 (fixed) , bounds=[-inf, inf]> <Parameter: ' - rough' , value=0 (fixed) , bounds=[-inf, inf]> <Parameter:' - volfrac solvent', value=0 (fixed) , bounds=[0.0, 1.0]> ________________________________________________________________________________ Parameters: 'Layer' <Parameter:'TaucLorentz - thick', value=180 , bounds=[150.0, 210.0]> ________________________________________________________________________________ Parameters: 'Am' <Parameter: '' , value=100 (fixed) , bounds=[-inf, inf]> <Parameter: '' , value=10 (fixed) , bounds=[-inf, inf]> ________________________________________________________________________________ Parameters: 'C' <Parameter: '' , value=1 (fixed) , bounds=[-inf, inf]> <Parameter: '' , value=2 (fixed) , bounds=[-inf, inf]> ________________________________________________________________________________ Parameters: 'En' <Parameter: '' , value=6 (fixed) , bounds=[-inf, inf]> <Parameter: '' , value=7 (fixed) , bounds=[-inf, inf]> <Parameter: 'Einf' , value=3 (fixed) , bounds=[-inf, inf]> <Parameter: 'Eg' , value=5.5198 (fixed) , bounds=[-inf, inf]> <Parameter:'TaucLorentz - rough', value=0 (fixed) , bounds=[-inf, inf]> <Parameter:'TaucLorentz - volfrac solvent', value=0 (fixed) , bounds=[0.0, 1.0]> ________________________________________________________________________________ Parameters: 'Si Substrate' <Parameter: ' - thick' , value=0 (fixed) , bounds=[-inf, inf]> <Parameter: ' - rough' , value=0 (fixed) , bounds=[-inf, inf]> <Parameter:' - volfrac solvent', value=0 (fixed) , bounds=[0.0, 1.0]>