Skip to content

Commit

Permalink
fix path bug
Browse files Browse the repository at this point in the history
  • Loading branch information
egmcbride committed Oct 29, 2024
1 parent c5e2888 commit 2205b3d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/dynamic_routing_analysis/decoding_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,9 @@ def decode_context_with_linear_shift(session=None,params=None,trials=None,units=
#save results
if use_zarr==False:
#make directory if does not exist
if not os.path.exists(savepath):
if not upath.UPath(savepath).is_dir():
upath.UPath(savepath).mkdir(parents=True)

(upath.UPath(savepath) / f"{session_id}_{filename}.pkl").write_bytes(
pickle.dumps(decoder_results, protocol=pickle.HIGHEST_PROTOCOL)
)
Expand Down Expand Up @@ -1317,6 +1318,7 @@ def concat_decoder_results(files,savepath=None,return_table=True,single_session=
try:
if not upath.UPath(savepath).is_dir():
upath.UPath(savepath).mkdir(parents=True)

if single_session:
linear_shift_df.to_csv(upath.UPath(savepath / (session_id+'_linear_shift_decoding_results.csv')))
else:
Expand Down

0 comments on commit 2205b3d

Please sign in to comment.