Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pathfilename to contain only the filename #202

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions skyllh/core/utils/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,11 @@ def estimate_mean_nsignal_for_ts_quantile( # noqa: C901
n_total_generated_trials += n_trials_total

if pathfilename is not None:
makedirs(os.path.dirname(pathfilename), exist_ok=True)
dirname = os.path.dirname(pathfilename)
if dirname:
# Create the directory if dirname is not empty.
makedirs(dirname, exist_ok=True)
# Save the trial data to file.
np.save(pathfilename, h0_ts_vals)
else:
if h0_trials.size < n_trials_total:
Expand Down Expand Up @@ -1385,8 +1389,11 @@ def create_trial_data_file( # noqa: C901
'No trials have been generated! Check your generation boundaries!')

if pathfilename is not None:
dirname = os.path.dirname(pathfilename)
if dirname:
# Create the directory if dirname is not empty.
makedirs(dirname, exist_ok=True)
# Save the trial data to file.
makedirs(os.path.dirname(pathfilename), exist_ok=True)
np.save(pathfilename, trial_data)

return (rss.seed, mean_n_sig, mean_n_sig_null, trial_data)
Expand Down Expand Up @@ -1484,8 +1491,11 @@ def extend_trial_data_file(
asrecarray=True)

if pathfilename is not None:
dirname = os.path.dirname(pathfilename)
if dirname:
# Create the directory if dirname is not empty.
makedirs(dirname, exist_ok=True)
# Save the trial data to file.
makedirs(os.path.dirname(pathfilename), exist_ok=True)
np.save(pathfilename, trial_data)

return trial_data
Expand Down