Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed Jul 1, 2024
1 parent c09a2ca commit c16ce52
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,5 @@ dmypy.json
**/*original_timestamps.npy
**/*qc.pdf
**/*temporal_alignment.png
**/*harp_line_search.png
**/*ephys-rig-QC_output.txt
14 changes: 10 additions & 4 deletions src/aind_ephys_rig_qc/generate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def generate_qc_report(
timestamp_alignment_method="local",
original_timestamp_filename="original_timestamps.npy",
num_chunks=3,
plot_drift_map=True
plot_drift_map=True,
):
"""
Generates a PDF report from an Open Ephys data directory
Expand Down Expand Up @@ -138,7 +138,9 @@ def generate_qc_report(
else:
print("Local timestamps was not overwritten.")

create_qc_plots(pdf, directory, num_chunks=num_chunks, plot_drift_map=plot_drift_map)
create_qc_plots(
pdf, directory, num_chunks=num_chunks, plot_drift_map=plot_drift_map
)

pdf.output(os.path.join(directory, report_name))

Expand Down Expand Up @@ -249,8 +251,12 @@ def get_event_info(events, stream_name):


def create_qc_plots(
pdf, directory, num_chunks=3, raw_chunk_size=1000, psd_chunk_size=10000,
plot_drift_map=True
pdf,
directory,
num_chunks=3,
raw_chunk_size=1000,
psd_chunk_size=10000,
plot_drift_map=True,
):
"""
Create QC plots for an Open Ephys data directory
Expand Down
2 changes: 1 addition & 1 deletion src/aind_ephys_rig_qc/pdf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def set_matplotlib_defaults(self):
if platform.system() == "Linux":
plt.rcParams["font.sans-serif"] = ["Nimbus Sans"]
else:
plt.rcParams["font.sans-serif"] = ["Arial"] # pragma: no cover
plt.rcParams["font.sans-serif"] = ["Arial"] # pragma: no cover

def embed_figure(self, fig, width=190):
"""
Expand Down
4 changes: 1 addition & 3 deletions src/aind_ephys_rig_qc/temporal_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ def search_harp_line(recording, directory, pdf=None):
+ f"short interval perc {p_short[line_ind]:.2f}"
)
else:
ax2.set_title(
f"{p_value[line_ind]:.2f}, {p_short[line_ind]:.2f}"
)
ax2.set_title(f"{p_value[line_ind]:.2f}, {p_short[line_ind]:.2f}")

# pick the line with even distribution overtime
# and has short inter-event interval
Expand Down
14 changes: 12 additions & 2 deletions tests/test_generate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,25 @@ def test_generate_report_harp(self, mock_input):
"""Check if output is pdf."""
directory = str(test_folder / test_dataset)
report_name = "qc.pdf"
generate_qc_report(directory, report_name, timestamp_alignment_method="harp", plot_drift_map=False)
generate_qc_report(
directory,
report_name,
timestamp_alignment_method="harp",
plot_drift_map=False,
)
self.assertTrue(os.path.exists(os.path.join(directory, report_name)))

@patch("builtins.input", return_value="n")
def test_generate_report_harp_not_overwriting(self, mock_input):
"""Check if output is pdf."""
directory = str(test_folder / test_dataset)
report_name = "qc.pdf"
generate_qc_report(directory, report_name, timestamp_alignment_method="harp", plot_drift_map=False)
generate_qc_report(
directory,
report_name,
timestamp_alignment_method="harp",
plot_drift_map=False,
)
self.assertTrue(os.path.exists(os.path.join(directory, report_name)))

@patch("builtins.input", return_value="n")
Expand Down

0 comments on commit c16ce52

Please sign in to comment.