Skip to content

Commit

Permalink
Move ExhaustPlugin to strax (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx authored May 1, 2024
1 parent e3acf58 commit 70a8f99
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 104 deletions.
19 changes: 0 additions & 19 deletions axidence/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,9 @@
import straxen
from straxen import units


export, __all__ = strax.exporter()


@export
class ExhaustPlugin(Plugin):
"""Plugin that exhausts all chunks when fetching data."""

def _fetch_chunk(self, d, iters, check_end_not_before=None):
while super()._fetch_chunk(d, iters, check_end_not_before=check_end_not_before):
pass
return False

def do_compute(self, chunk_i=None, **kwargs):
if chunk_i != 0:
raise RuntimeError(
f"{self.__class__.__name__} is an ExhaustPlugin. "
"It should read all chunks together can process them together."
)
return super().do_compute(chunk_i=chunk_i, **kwargs)


@export
class RunMetaPlugin(Plugin):
"""Plugin that provides run metadata."""
Expand Down
3 changes: 1 addition & 2 deletions axidence/plugins/meta/run_meta.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import numpy as np
import strax

from ...plugin import ExhaustPlugin
from strax import ExhaustPlugin


class RunMeta(ExhaustPlugin):
Expand Down
3 changes: 1 addition & 2 deletions axidence/plugins/pairing/peaks_paired.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from immutabledict import immutabledict
import numpy as np
import strax
from strax import Plugin, DownChunkingPlugin
from strax import Plugin, ExhaustPlugin, DownChunkingPlugin
import straxen
from straxen import units
from straxen import PeakProximity
Expand All @@ -11,7 +11,6 @@
from ...utils import copy_dtype
from ...samplers import SAMPLERS
from ...dtypes import peak_positions_dtype
from ...plugin import ExhaustPlugin


class PeaksPaired(ExhaustPlugin, DownChunkingPlugin):
Expand Down
2 changes: 1 addition & 1 deletion axidence/plugins/salting/event_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from typing import Tuple
import numpy as np
import strax
from strax import ExhaustPlugin
import straxen
from straxen import Events, EventBasics

from ...utils import needed_dtype, merge_salted_real
from ...plugin import ExhaustPlugin


class EventsSalted(Events, ExhaustPlugin):
Expand Down
3 changes: 1 addition & 2 deletions axidence/plugins/salting/events_salting.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import numpy as np
import strax
from strax import DownChunkingPlugin
from strax import ExhaustPlugin, DownChunkingPlugin
import straxen
from straxen import units, EventBasics, EventPositions

from ...utils import copy_dtype
from ...samplers import SAMPLERS
from ...plugin import ExhaustPlugin


class EventsSalting(ExhaustPlugin, DownChunkingPlugin, EventPositions, EventBasics):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repository = "https://github.com/dachengx/axidence"
documentation = "https://readthedocs.org/projects/axidence/"

[tool.poetry.dependencies]
strax = ">=1.6.2"
strax = ">=1.6.3"
straxen = ">=2.2.1"
GOFevaluation = ">=0.1.4"

Expand Down
77 changes: 0 additions & 77 deletions tests/test_exhaust_plugin.py

This file was deleted.

0 comments on commit 70a8f99

Please sign in to comment.