Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jackbdoughty committed Oct 9, 2024
1 parent 58b87d6 commit 0f5a152
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/ibex_bluesky_core/devices/dae/dae_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, dae_prefix: str, *, spectra: int, period: int, name: str = ""
int, f"{dae_prefix}SPEC:{period}:{spectra}:YC.NORD"
)

self.stddev, self._stddev_setter = soft_signal_r_and_setter(NDArray[float32], [0.0])
self.stddev, self._stddev_setter = soft_signal_r_and_setter(NDArray[float32], [])

super().__init__(name=name)

Expand Down Expand Up @@ -85,7 +85,7 @@ async def read_counts_per_time(self) -> NDArray[float32]:
async def read_counts_uncertainties(self) -> NDArray[float32]:
"""Read a correctly-sized array of uncertainties for each count."""

return await self._read_sized(self.stddev, self.counts_size) # type: ignore
return await self._read_sized(self.stddev, self.counts_size) # type: ignore ???????

async def read_spectrum_dataarray(self) -> sc.DataArray:
"""Get a scipp DataArray containing the current data from this spectrum.
Expand Down
12 changes: 1 addition & 11 deletions src/ibex_bluesky_core/devices/simpledae/reducers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import asyncio
from abc import ABCMeta, abstractmethod
from typing import TYPE_CHECKING, Collection, Sequence, Tuple
from typing import TYPE_CHECKING, Collection, Sequence

import numpy as np
import scipp as sc
Expand Down Expand Up @@ -91,11 +91,6 @@ def additional_readable_signals(self, dae: "SimpleDae") -> list[Device]:
self.det_counts,
self.intensity,
self.denominator(dae),
]

def additional_readable_signals_uncertainties(self, dae: "SimpleDae") -> list[Device]:
"""Publish interesting signals derived or used by this reducer, including respective uncertainties."""
return [
self.det_counts_stddev,
self.intensity_stddev,
]
Expand Down Expand Up @@ -186,11 +181,6 @@ def additional_readable_signals(self, dae: "SimpleDae") -> list[Device]:
self.det_counts,
self.mon_counts,
self.intensity,
]

def additional_readable_signals_uncertainties(self, dae: "SimpleDae") -> list[Device]:
"""Publish interesting signals derived or used by this reducer, including respective uncertainties."""
return [
self.det_counts_stddev,
self.mon_counts_stddev,
self.intensity_stddev,
Expand Down
4 changes: 2 additions & 2 deletions tests/devices/simpledae/test_reducers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def test_scalar_normalizer_publishes_uncertainties(
simpledae: SimpleDae,
good_frames_reducer: GoodFramesNormalizer,
):
readables = good_frames_reducer.additional_readable_signals_uncertainties(simpledae)
readables = good_frames_reducer.additional_readable_signals(simpledae)
assert good_frames_reducer.intensity_stddev in readables
assert good_frames_reducer.det_counts_stddev in readables

Expand Down Expand Up @@ -213,7 +213,7 @@ async def test_monitor_normalizer_publishes_raw_and_normalized_count_uncertainti
simpledae: SimpleDae,
monitor_normalizer: MonitorNormalizer,
):
readables = monitor_normalizer.additional_readable_signals_uncertainties(simpledae)
readables = monitor_normalizer.additional_readable_signals(simpledae)
assert monitor_normalizer.intensity_stddev in readables
assert monitor_normalizer.det_counts_stddev in readables
assert monitor_normalizer.mon_counts_stddev in readables
Expand Down

0 comments on commit 0f5a152

Please sign in to comment.