Skip to content

Commit

Permalink
Metadata linked up, just not pointing in the right place right now
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-wilkins committed Oct 7, 2024
1 parent d1ef1d4 commit f07f261
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
3 changes: 1 addition & 2 deletions sasdata/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def summary(self, indent = " "):
s += f"{indent}{data}\n"

s += f"{indent}Metadata:\n"
for key in self._raw_metadata.children:
s += self._raw_metadata.children[key].summary(2, indent)
s += self.metadata.summary()

return s
25 changes: 18 additions & 7 deletions sasdata/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def summary(self):
return (f"Aperture:\n"
f" Name: {self.name.value}\n"
f" Aperture size: {self.size.value}\n"
f" Aperture distance: {self.distance.value}")
f" Aperture distance: {self.distance.value}\n")

class Collimation:
"""
Expand All @@ -112,7 +112,7 @@ def __init__(self, target_object: AccessorTarget):


# Todo - how do we handle this
self.collimator = Collimation(target_object)
# self.collimator = Collimation(target_object)

def summary(self):

Expand Down Expand Up @@ -193,7 +193,7 @@ def summary(self) -> str:
f" Min. Wavelength: {self.wavelength_min.value}\n"
f" Max. Wavelength: {self.wavelength_max.value}\n"
f" Wavelength Spread: {self.wavelength_spread.value}\n"
f" Beam Size: {self.beam_size}\n")
f" Beam Size: {self.beam_size.value}\n")



Expand Down Expand Up @@ -289,13 +289,13 @@ def single_line_desc(self):
"""
return f"{self.name.value} {self.date.value} {self.description.value}"

def __str__(self):
def summary(self):
return (f"Process:\n"
f" Name: {self.name.value}\n"
f" Date: {self.date.value}\n"
f" Description: {self.description.value}\n"
f" Term: {self.term.value}\n"
f" Notes: {self.notes.value}"
f" Notes: {self.notes.value}\n"
)

class TransmissionSpectrum(AccessorTarget):
Expand Down Expand Up @@ -323,7 +323,7 @@ def __init__(self, target_object):
self.transmission_deviation = DimensionlessAccessor[ArrayLike](target_object,
"transmission.transmission_deviation",
"transmission.transmission_deviation.units",
default_units=units.none)
default_unit=units.none)


def summary(self) -> str:
Expand All @@ -344,4 +344,15 @@ def __init__(self, target: AccessorTarget):
self.process = Process(target)
self.sample = Sample(target)
self.source = Source(target)
self.transmission_spectrum = TransmissionSpectrum(target)
self.transmission_spectrum = TransmissionSpectrum(target)

def summary(self):
return (
self.aperture.summary() +
self.collimation.summary() +
self.detector.summary() +
self.process.summary() +
self.sample.summary() +
self.source.summary() +
self.transmission_spectrum.summary()
)

0 comments on commit f07f261

Please sign in to comment.