|
4 | 4 |
|
5 | 5 | import enum |
6 | 6 | from datetime import datetime |
7 | | -from typing import NewType |
8 | 7 |
|
9 | | -import scipp as sc |
10 | 8 | import scippnexus as snx |
11 | 9 | from dateutil.parser import parse as parse_datetime |
12 | | -from pydantic import BaseModel, ConfigDict, EmailStr |
| 10 | +from pydantic import BaseModel, EmailStr |
13 | 11 |
|
14 | 12 | from ._orcid import ORCIDiD |
15 | 13 |
|
@@ -292,14 +290,6 @@ def _deduce_package_source_url(package_name: str) -> str | None: |
292 | 290 | return None |
293 | 291 |
|
294 | 292 |
|
295 | | -PulseDuration = NewType('PulseDuration', sc.Variable) |
296 | | -PulseDuration.__doc__ = """Duration of a source pulse.""" |
297 | | -SourceFrequency = NewType('SourceFrequency', sc.Variable) |
298 | | -SourceFrequency.__doc__ = """Frequency of a source pulse.""" |
299 | | -SourcePeriod = NewType('SourcePeriod', sc.Variable) |
300 | | -SourcePeriod.__doc__ = """Period of a source pulse.""" |
301 | | - |
302 | | - |
303 | 293 | class SourceType(str, enum.Enum): |
304 | 294 | """Type of source. |
305 | 295 |
|
@@ -327,36 +317,16 @@ class Source(BaseModel): |
327 | 317 | The ESS source is provided as ``scippneutron.meta.ESS_SOURCE``. |
328 | 318 | """ |
329 | 319 |
|
330 | | - # Needed to allow Scipp objects |
331 | | - model_config = ConfigDict(arbitrary_types_allowed=True) |
332 | | - |
333 | | - frequency: SourceFrequency |
334 | | - """The source frequency in Hz.""" |
335 | | - pulse_duration: PulseDuration |
336 | | - """The pulse duration in s.""" |
337 | | - |
| 320 | + name: str | None = None |
| 321 | + """Name of the source.""" |
338 | 322 | source_type: SourceType |
339 | 323 | """Type of this source.""" |
340 | 324 | probe: RadiationProbe |
341 | 325 | """Radiation probe of the source.""" |
342 | 326 |
|
343 | | - @property |
344 | | - def period(self) -> SourcePeriod: |
345 | | - """The source period in ns.""" |
346 | | - return SourcePeriod((1 / self.frequency).to(unit='ns')) |
347 | | - |
348 | | - def to_pipeline_params(self) -> dict[type, object]: |
349 | | - """Package the physical source parameters for a Sciline pipeline.""" |
350 | | - return { |
351 | | - PulseDuration: self.pulse_duration, |
352 | | - SourceFrequency: self.frequency, |
353 | | - SourcePeriod: self.period, |
354 | | - } |
355 | | - |
356 | 327 |
|
357 | 328 | ESS_SOURCE = Source( |
358 | | - frequency=SourceFrequency(sc.scalar(14.0, unit='Hz')), |
359 | | - pulse_duration=PulseDuration(sc.scalar(0.003, unit='s')), |
| 329 | + name="ESS Butterfly", |
360 | 330 | source_type=SourceType.SpallationNeutronSource, |
361 | 331 | probe=RadiationProbe.Neutron, |
362 | 332 | ) |
|
0 commit comments