refnx / refellips

Spectroscopic ellipsometry data analysis in Python
https://refellips.readthedocs.io
Other
8 stars 9 forks source link

Parameter names for Dispersion Models #89

Open SirNate0 opened 3 months ago

SirNate0 commented 3 months ago

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]>
andyfaff commented 3 months ago

@SirNate0, thank you for the feedback. We'll look into adding names for the dispersion parameters where we can. The indentation aspect I'm not so sure about, but we'll bear that in mind.

Just out of interest, what kind of systems are you interested in studying with refellips?

SirNate0 commented 1 week ago

Sorry for taking so long to get back to you. I was trying to model a bilayer of less standard semiconductor films (AlN, and ScAlN). In the end I went back to using CompleteEASE to do it (I've used it before, but I wanted to give this package a try analyzing the data from home rather than at the work computers with CompleteEASE instealled).

andyfaff commented 1 week ago

Are there any features that you think need to be added?