Skip to content

Commit

Permalink
Rename meta to metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jl-wynen committed Jan 24, 2025
1 parent 3e6baee commit bb19dd8
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ and possible confusion of `theta` (from Bragg’s law) with `theta` in spherical
conversion
io
logging
meta
metadata
peaks
tof
```
8 changes: 4 additions & 4 deletions src/scippneutron/io/cif.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
Assemble data and metadata using a :class:`CIF` builder:
>>> from scippneutron.io import cif
>>> from scippneutron import meta
>>> from scippneutron import metadata
>>> cif_ = (
... cif.CIF('my-data', comment="This is a demo of ScippNeutron's CIF builder.")
... .with_beamline(meta.Beamline(name='fake', facility='made up'))
... .with_authors(meta.Person(
... .with_beamline(metadata.Beamline(name='fake', facility='made up'))
... .with_authors(metadata.Person(
... name='Jane Doe',
... orcid='0000-0000-0000-0001',
... corresponding=True
Expand Down Expand Up @@ -141,7 +141,7 @@

import scipp as sc

from ..meta import Beamline, Person, Source, SourceType
from ..metadata import Beamline, Person, Source, SourceType
from ._files import open_or_pass


Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Beamline(BaseModel):
The location of the beamline is split into ``facility`` and ``site``, where
a 'facility' is located at a 'site'. For example:
>>> from scippneutron.meta import Beamline
>>> from scippneutron.metadata import Beamline
>>> beamline = Beamline(
... name='Amor',
... facility='SINQ',
Expand Down Expand Up @@ -197,7 +197,7 @@ class Software(BaseModel):
The piece of software should be specified as precisely as possible.
For example, a release version of ScippNeutron could be specified as follows:
>>> from scippneutron.meta import Software
>>> from scippneutron.metadata import Software
>>> software = Software(
... name='ScippNeutron',
... version='24.11.0',
Expand Down
File renamed without changes.
30 changes: 15 additions & 15 deletions tests/io/cif_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
import scipp as sc

from scippneutron import __version__, meta
from scippneutron import __version__, metadata
from scippneutron.io import cif


Expand Down Expand Up @@ -904,7 +904,7 @@ def test_builder_writes_audit_with_multiple_reducers() -> None:
def test_builder_with_beamline() -> None:
original = cif.CIF()
cif_ = original.with_beamline(
meta.Beamline(name='DREAM', facility='ESS'),
metadata.Beamline(name='DREAM', facility='ESS'),
comment="Dreaming of things to come",
)
res = save_to_str(cif_)
Expand All @@ -923,12 +923,12 @@ def test_builder_with_beamline() -> None:
def test_builder_with_beamline_and_source() -> None:
original = cif.CIF()
cif_ = original.with_beamline(
meta.Beamline(name='Balder', facility='MAX IV'),
meta.Source(
frequency=meta.SourceFrequency(sc.scalar(0)),
pulse_duration=meta.PulseDuration(sc.scalar(0)),
source_type=meta.SourceType.SynchrotronXraySource,
probe=meta.RadiationProbe.Xray,
metadata.Beamline(name='Balder', facility='MAX IV'),
metadata.Source(
frequency=metadata.SourceFrequency(sc.scalar(0)),
pulse_duration=metadata.PulseDuration(sc.scalar(0)),
source_type=metadata.SourceType.SynchrotronXraySource,
probe=metadata.RadiationProbe.Xray,
),
)
res = save_to_str(cif_)
Expand Down Expand Up @@ -1072,7 +1072,7 @@ def test_builder_powder_calibration():


def test_builder_single_contact_author() -> None:
author = meta.Person(
author = metadata.Person(
name='Jane Doe',
email='[email protected]',
address='Partikelgatan, Lund',
Expand All @@ -1089,7 +1089,7 @@ def test_builder_single_contact_author() -> None:


def test_builder_regular_author() -> None:
author = meta.Person(
author = metadata.Person(
name='Jane Doe',
email='[email protected]',
address='Partikelgatan, Lund',
Expand All @@ -1107,14 +1107,14 @@ def test_builder_regular_author() -> None:

def test_builder_multiple_regular_authors() -> None:
authors = [
meta.Person(
metadata.Person(
name='Jane Doe',
email='[email protected]',
address='Partikelgatan, Lund',
orcid='https://orcid.org/0000-0000-0000-0001',
corresponding=False,
),
meta.Person(
metadata.Person(
name='Max Mustermann',
email='[email protected]',
orcid='https://orcid.org/0000-0000-0001-0082',
Expand All @@ -1135,7 +1135,7 @@ def test_builder_multiple_regular_authors() -> None:


def test_builder_regular_author_role() -> None:
author = meta.Person(
author = metadata.Person(
name='Jane Doe',
role='measurement',
corresponding=False,
Expand All @@ -1160,9 +1160,9 @@ def test_builder_regular_author_role() -> None:
def test_builder_many_fields() -> None:
cif_ = (
cif.CIF('my/name')
.with_authors(meta.Person(name='Jane Doe'))
.with_authors(metadata.Person(name='Jane Doe'))
.with_reducers('test-package')
.with_beamline(beamline=meta.Beamline(name='fake'))
.with_beamline(beamline=metadata.Beamline(name='fake'))
)
result = save_to_str(cif_)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

import scippneutron as scn
import scippneutron.data
from scippneutron import meta
from scippneutron import metadata


def test_experiment_from_nexus_entry() -> None:
with snx.File(scn.data.get_path('PG3_4844_event.nxs')) as f:
experiment = meta.Measurement.from_nexus_entry(f['entry'])
experiment = metadata.Measurement.from_nexus_entry(f['entry'])
assert experiment.title == 'diamond cw0.533 4.22e12 60Hz [10x30]'
assert experiment.run_number == '4844'
assert experiment.experiment_id == 'IPTS-2767'
Expand All @@ -24,16 +24,16 @@ def test_experiment_from_nexus_entry() -> None:

def test_beamline_from_nexus_entry() -> None:
with snx.File(scn.data.get_path('PG3_4844_event.nxs')) as f:
beamline = meta.Beamline.from_nexus_entry(f['entry'])
beamline = metadata.Beamline.from_nexus_entry(f['entry'])
assert beamline.name == 'POWGEN'
assert beamline.facility is None
assert beamline.site is None
assert beamline.revision is None


def test_software_from_from_package_metadata_first_party() -> None:
software = meta.Software.from_package_metadata('scippneutron')
expected = meta.Software(
software = metadata.Software.from_package_metadata('scippneutron')
expected = metadata.Software(
name='scippneutron',
version=scn.__version__,
url='https://github.com/scipp/scippneutron',
Expand All @@ -43,8 +43,8 @@ def test_software_from_from_package_metadata_first_party() -> None:


def test_software_from_from_package_metadata_third_party() -> None:
software = meta.Software.from_package_metadata('scipp')
expected = meta.Software(
software = metadata.Software.from_package_metadata('scipp')
expected = metadata.Software(
name='scipp',
version=sc.__version__,
url='https://github.com/scipp/scipp',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from pydantic import BaseModel

from scippneutron.meta import ORCIDiD
from scippneutron.metadata import ORCIDiD


def test_orcid_init_no_resolver() -> None:
Expand Down

0 comments on commit bb19dd8

Please sign in to comment.