Note
Go to the end to download the full example code.
Project creation
In this example, we create a Project from scratch
import spectrochempy as scp
Create a project with subprojects
proj = scp.Project(
scp.Project(name="P350", label=r"$\mathrm{M_P}\,(623\,K)$"),
scp.Project(name="A350", label=r"$\mathrm{M_A}\,(623\,K)$"),
scp.Project(name="B350", label=r"$\mathrm{M_B}\,(623\,K)$"),
name="project_1",
label="main project",
)
proj.projects_names
['P350', 'A350', 'B350']
Add datasets to a subproject
Create two datasets:
ir = scp.NDDataset([1.1, 2.2, 3.3], coords=[[1, 2, 3]])
ir
tg = scp.NDDataset([1, 3, 4], coords=[[1, 2, 3]])
tg
Add them to the A350 subproject:
Access project members
print(proj.A350)
print(proj)
print(proj.A350.label)
print(proj.A350.TG)
Project A350:
⤷ IR (dataset)
⤷ TG (dataset)
Project project_1:
⤷ P350 (sub-project)
⤷ A350 (sub-project)
⤷ IR (dataset)
⤷ TG (dataset)
⤷ B350 (sub-project)
$\mathrm{M_A}\,(623\,K)$
NDDataset: [float64] unitless (size: 3)
Save and reload
PosixPath('/home/runner/work/spectrochempy/spectrochempy/build/~gallery_examples/core/e_project/project_1.pscp')
newproj = scp.Project.load("project_1", allow_unsafe_legacy=True)
newproj
Total running time of the script: (0 minutes 0.010 seconds)