Skip to content

Commit

Permalink
Merge pull request #198 from BrainCOGS/adding-raw-strings-and-package…
Browse files Browse the repository at this point in the history
…-minimum

Fix regex patterns and add minimum version for scikit-image
  • Loading branch information
kushalbakshi authored Aug 14, 2024
2 parents 9299142 + 711dd48 commit 27c56ea
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion element_array_ephys/ephys_acute.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def auto_generate_entries(cls, session_key):

probe_dir = meta_filepath.parent
try:
probe_number = re.search("(imec)?\d{1}$", probe_dir.name).group()
probe_number = re.search(r"(imec)?\d{1}$", probe_dir.name).group()
probe_number = int(probe_number.replace("imec", ""))
except AttributeError:
probe_number = meta_fp_idx
Expand Down
2 changes: 1 addition & 1 deletion element_array_ephys/ephys_no_curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def auto_generate_entries(cls, session_key):

probe_dir = meta_filepath.parent
try:
probe_number = re.search("(imec)?\d{1}$", probe_dir.name).group()
probe_number = re.search(r"(imec)?\d{1}$", probe_dir.name).group()
probe_number = int(probe_number.replace("imec", ""))
except AttributeError:
probe_number = meta_fp_idx
Expand Down
4 changes: 2 additions & 2 deletions element_array_ephys/readers/kilosort.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ def extract_clustering_info(cluster_output_dir):
is_curated = bool(np.any(curation_row))
if creation_time is None and is_curated:
row_meta = phylog.meta[np.where(curation_row)[0].max()]
datetime_str = re.search("\d{2}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}", row_meta)
datetime_str = re.search(r"\d{2}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}", row_meta)
if datetime_str:
creation_time = datetime.strptime(
datetime_str.group(), "%Y-%m-%d %H:%M:%S"
)
else:
creation_time = datetime.fromtimestamp(phylog_filepath.stat().st_ctime)
time_str = re.search("\d{2}:\d{2}:\d{2}", row_meta)
time_str = re.search(r"\d{2}:\d{2}:\d{2}", row_meta)
if time_str:
creation_time = datetime.combine(
creation_time.date(),
Expand Down
4 changes: 2 additions & 2 deletions element_array_ephys/readers/kilosort_triggering.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(

def parse_input_filename(self):
meta_filename = next(self._npx_input_dir.glob("*.ap.meta")).name
match = re.search("(.*)_g(\d)_t(\d+|cat)\.imec(\d?)\.ap\.meta", meta_filename)
match = re.search(r"(.*)_g(\d)_t(\d+|cat)\.imec(\d?)\.ap\.meta", meta_filename)
session_str, gate_str, trigger_str, probe_str = match.groups()
return session_str, gate_str, trigger_str, probe_str or "0"

Expand Down Expand Up @@ -719,7 +719,7 @@ def _get_median_subtraction_duration_from_log(self):
) and previous_line.startswith("Total processing time:"):
# regex to search for the processing duration - a float value
duration = int(
re.search("\d+\.?\d+", previous_line).group()
re.search(r"\d+\.?\d+", previous_line).group()
)
return duration
previous_line = line
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"plotly",
"seaborn",
"spikeinterface",
"scikit-image",
"scikit-image>=0.20",
"nbformat>=4.2.0",
"pyopenephys>=1.1.6",
],
Expand Down

0 comments on commit 27c56ea

Please sign in to comment.