-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
156 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.2.5 | ||
current_version = 0.3.0 | ||
commit = True | ||
tag = True | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = "0.2.5" | ||
__version__ = "0.3.0" | ||
|
||
from . import plugins | ||
from .plugins import * | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import strax | ||
import straxen | ||
import numpy as np | ||
import logging | ||
|
||
logging.basicConfig(handlers=[logging.StreamHandler()]) | ||
|
||
class FuseBasePlugin(strax.Plugin): | ||
|
||
"""Base plugin for fuse plugins""" | ||
|
||
#Forbid rechunking | ||
rechunk_on_save = False | ||
|
||
#Lets wait 10 minutes for the plugin to finish | ||
input_timeout = 600 | ||
|
||
#Config options | ||
debug = straxen.URLConfig( | ||
default=False, type=bool, track=False, | ||
help='Show debug informations', | ||
) | ||
|
||
deterministic_seed = straxen.URLConfig( | ||
default=True, type=bool, | ||
help='Set the random seed from lineage and run_id, or pull the seed from the OS.', | ||
) | ||
|
||
def setup(self): | ||
super().setup() | ||
|
||
log = logging.getLogger(f"{self.__class__.__name__}") | ||
|
||
if self.debug: | ||
log.setLevel('DEBUG') | ||
log.debug(f"Running {self.__class__.__name__} version {self.__version__} in debug mode") | ||
else: | ||
log.setLevel('INFO') | ||
|
||
if self.deterministic_seed: | ||
hash_string = strax.deterministic_hash((self.run_id, self.lineage)) | ||
self.seed = int(hash_string.encode().hex(), 16) | ||
self.rng = np.random.default_rng(seed = self.seed) | ||
log.debug(f"Generating random numbers from seed {self.seed}") | ||
else: | ||
self.rng = np.random.default_rng() | ||
log.debug(f"Generating random numbers with seed pulled from OS") | ||
|
||
class FuseBaseDownChunkingPlugin(strax.DownChunkingPlugin, FuseBasePlugin): | ||
|
||
"""Base plugin for fuse DownChunkingPlugins""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.