Compare commits

...

2 Commits

Author SHA1 Message Date
9e8dc06c26 plot without decibels and beat without squaring 2024-09-29 18:28:01 +02:00
bf8f3f5cb7 adding comments 2024-09-29 18:27:27 +02:00
2 changed files with 23 additions and 5 deletions

View File

@ -116,7 +116,7 @@ class PyRelacs(QMainWindow):
beat_squared = beat**2
f, powerspec = welch(beat, fs=40_000.0)
powerspec = decibel(powerspec)
# powerspec = decibel(powerspec)
f_sq, powerspec_sq = welch(beat_squared, fs=40_000.0)
powerspec_sq = decibel(powerspec_sq)
@ -124,12 +124,12 @@ class PyRelacs(QMainWindow):
pen = pg.mkPen(colors[i])
self.beat_plot.plot(
np.arange(0, len(beat)) / 40_000.0,
beat_squared,
beat,
pen=pen,
# name=stim.name,
)
self.power_plot.plot(f_sq, powerspec_sq, pen=pen)
self.power_plot.plot(f[peaks], powerspec_sq[peaks], pen=None, symbol="x")
self.power_plot.plot(f, powerspec, pen=pen)
# self.power_plot.plot(f[peaks], powerspec_sq[peaks], pen=None, symbol="x")
def connect_dac(self):
devices = uldaq.get_daq_device_inventory(uldaq.InterfaceType.USB)

View File

@ -2,6 +2,7 @@ import sys
import importlib.util
import ast
import pathlib
from typing import Tuple
from IPython import embed
import nixio as nix
@ -11,12 +12,19 @@ log = config_logging()
class Repro:
"""
Repro Class that searches in the repro folder for classes instances and executes the
the run function in the searched class
"""
def __init__(self) -> None:
pass
def run_repro(
self, nix_file: nix.File, name: str, file: pathlib.Path, *args, **kwargs
) -> None:
spec = importlib.util.spec_from_file_location("rep", file)
if not spec:
log.error("Could not load the file")
@ -33,7 +41,17 @@ class Repro:
else:
raise AttributeError(f"{file.name} has no {name} class")
def names_of_repros(self):
def names_of_repros(self) -> Tuple[list, list]:
"""
Searches for class names in the repro folder in all python files
Returns
-------
Tuple[list, list]
list of class names
list of file names from the class names
"""
file_path_cur = pathlib.Path(__file__).parent
python_files = list(file_path_cur.glob("**/*.py"))
exclude_files = ["repros.py", "__init__.py"]