Skip to content

Commit

Permalink
ready to expose data
Browse files Browse the repository at this point in the history
  • Loading branch information
andped10 committed Oct 10, 2024
1 parent 285472a commit df8d366
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/easyreflectometry/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from .data_store import DataSet1D
from .data_store import ProjectData
from .measurement import load

__all__ = [
load,
ProjectData,
DataSet1D,
]
37 changes: 33 additions & 4 deletions src/easyreflectometry/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from easyscience import global_object
from easyscience.fitting import AvailableMinimizers

from easyreflectometry.data.data_store import DataSet1D
from easyreflectometry.data import DataSet1D
from easyreflectometry.model import Model
from easyreflectometry.model import ModelCollection
from easyreflectometry.sample import Layer
Expand All @@ -19,6 +19,29 @@
from easyreflectometry.sample import Sample
from easyreflectometry.sample.collections.base_collection import BaseCollection

MODELS_SAMPLE_DATA = [
DataSet1D(
name='Sample Data 0',
x=np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
y=np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
)
]
MODELS_MODEL_DATA = [
DataSet1D(
name='Model Data 0',
x=np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
y=np.array([1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5]),
)
]
EXPERIMENTAL_DATA = [
DataSet1D(
name='Example Data 0',
x=np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
y=np.array([0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5]),
ye=np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]),
)
]


class Project:
def __init__(self):
Expand All @@ -36,9 +59,6 @@ def __init__(self):
self._created = False
self._with_experiments = False

self._xArrays = [np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])]
self._yCalcArrays = [np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])]

def reset(self):
del self._models
del self._materials
Expand Down Expand Up @@ -99,6 +119,15 @@ def experiments(self, experiments: List[DataSet1D]) -> None:
def path_json(self):
return self.path / 'project.json'

def sample_data_for_model_at_index(self, index: int = 0) -> DataSet1D:
return MODELS_SAMPLE_DATA[index]

def model_data_for_model_at_index(self, index: int = 0) -> DataSet1D:
return MODELS_MODEL_DATA[index]

def experimental_data_for_model_at_index(self, index: int = 0) -> DataSet1D:
return EXPERIMENTAL_DATA[index]

def default_model(self):
self._replace_collection(MaterialCollection(), self._materials)

Expand Down

0 comments on commit df8d366

Please sign in to comment.