new: Rng customization in NoiseMeasurement
This commit is contained in:
@@ -16,6 +16,7 @@ class NoiseMeasurement:
|
||||
psd: np.ndarray
|
||||
phase: np.ndarray | None = None
|
||||
psd_interp: interp1d = field(init=False)
|
||||
rng: np.random.Generator = field(default_factory=np.random.default_rng)
|
||||
_window_functions: ClassVar[dict[str, Callable[[int], np.ndarray]]] = {}
|
||||
|
||||
@classmethod
|
||||
@@ -190,7 +191,7 @@ class NoiseMeasurement:
|
||||
|
||||
freq, spec = self.sample_spectrum(nt, dt)
|
||||
if phase is None:
|
||||
phase = 2 * np.pi * np.random.rand(len(freq))
|
||||
phase = 2 * np.pi * self.rng.random(len(freq))
|
||||
time, dt = math.irfftfreq(freq, True)
|
||||
|
||||
amp = np.sqrt(spec) * np.exp(1j * phase)
|
||||
|
||||
@@ -332,7 +332,7 @@ def _bundle_external_files(params: Parameters, io: PropagationIOHandler):
|
||||
existing_files = set(io.keys())
|
||||
for _, value in params.items():
|
||||
if isinstance(value, DataFile):
|
||||
data = value.load_data()
|
||||
data = value.load_bytes()
|
||||
|
||||
value.io = io
|
||||
value.prefix = "zip"
|
||||
|
||||
Reference in New Issue
Block a user