Skip to content

Commit

Permalink
add material in get index of given material
Browse files Browse the repository at this point in the history
  • Loading branch information
andped10 committed Nov 13, 2024
1 parent ce52a44 commit 3d3b404
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/easyreflectometry/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from easyreflectometry.model import PercentageFhwm
from easyreflectometry.sample import Layer
from easyreflectometry.sample import MaterialCollection
from easyreflectometry.sample import Material
from easyreflectometry.sample import Multilayer
from easyreflectometry.sample import Sample
from easyreflectometry.sample.collections.base_collection import BaseCollection
Expand Down Expand Up @@ -211,22 +212,22 @@ def path_json(self):

def get_index_air(self) -> int:
if 'Air' not in [material.name for material in self._materials]:
self._materials.add_material('Air', 0.0, 0.0)
self._materials.add_material(Material(name='Air', sld=0.0, isld=0.0))
return [material.name for material in self._materials].index('Air')

def get_index_si(self) -> int:
if 'Si' not in [material.name for material in self._materials]:
self._materials.add_material('Si', 2.07, 0.0)
self._materials.add_material(Material(name='Si', sld=2.07, isld=0.0))
return [material.name for material in self._materials].index('Si')

def get_index_sio2(self) -> int:
if 'SiO2' not in [material.name for material in self._materials]:
self._materials.add_material('SiO2', 3.47, 0.0)
self._materials.add_material(Material(name='SiO2', sld=3.47, isld=0.0))
return [material.name for material in self._materials].index('SiO2')

def get_index_d2o(self) -> int:
if 'D2O' not in [material.name for material in self._materials]:
self._materials.add_material('D2O', 6.36, 0.0)
self._materials.add_material(Material(name='D2O', sld=6.36, isld=0.0))
return [material.name for material in self._materials].index('D2O')

def load_experiment_for_model_at_index(self, path: Union[Path, str], index: Optional[int] = 0) -> None:
Expand Down

0 comments on commit 3d3b404

Please sign in to comment.