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

fprintf invalid format in rezToPhy2 #336

Closed
DradeAW opened this issue Feb 12, 2021 · 10 comments · Fixed by #595
Closed

fprintf invalid format in rezToPhy2 #336

DradeAW opened this issue Feb 12, 2021 · 10 comments · Fixed by #595

Comments

@DradeAW
Copy link

DradeAW commented Feb 12, 2021

Hi,

I'm trying out Kilosort 3, and I managed to make it run, but it crashes at the very end (it saves everything to phy except for the params.py file)

The error is:

Error using fprintf
Invalid format.

Error in rezToPhy2 (line 197)
        fprintf(fid,['dat_path = ''', strrep(rez.ops.fproc, '\', '/') '''\n']);

Error in main_kilosort3 (line 52)
rezToPhy2(rez, rootZ);
@marius10p
Copy link
Contributor

Can you stop it in debug mode to see what fprintf is upset about? The problem seems to be specific to your data paths and maybe file system format. What OS?

@DradeAW
Copy link
Author

DradeAW commented Feb 12, 2021

I'm re-running it with a breakpoint on the fprintf, but I'm not sure how to debug it (this is the very first time I'm using Matlab).

I'm on Ubuntu 20.04, with Matlab R2019b.

@marius10p
Copy link
Contributor

marius10p commented Feb 12, 2021 via email

@DradeAW
Copy link
Author

DradeAW commented Feb 12, 2021

sprintf did not change anything.

The value of rez.ops.fproc is /users/nsr/wyngaard/Documents/tmp/temp_wh.dat (shouldn't it point to the original dat file?).

The error is the line fprintf(fid,['dat_path = ''', strrep(rez.ops.fproc, '\', '/') '''\n']); itself.

@marius10p
Copy link
Contributor

It's supposed to point to the drift-corrected file created by Kilosort, otherwise the clusters won't make sense if you have a lot of drift. I don't really know why that line is failing for you. The params.py file should just look like this:

dat_path = 'G:/Spikes/Sample/temp_wh.dat'
n_channels_dat = 383
dtype = 'int16'
offset = 0
sample_rate = 30000.
hp_filtered = True

@DradeAW
Copy link
Author

DradeAW commented Feb 12, 2021

I tried the following in the console, does it help?

>> aze = "/users/nsr/wyngaard/Documents/tmp/temp_wh.dat"

aze = 

    "/users/nsr/wyngaard/Documents/tmp/temp_wh.dat"

>> ['dat_path =''', strrep(aze, '\', '/') '''\n']

ans = 

  1×3 string array

    "dat_path ='"    "/users/nsr/wyngaard/Documents/tmp/temp_wh.dat"    "'\n"

>> fid = fopen("/users/nsr/wyngaard/Documents/cells_tracking/0153/session_1/rec/test.py", 'w');
>> fid

fid =

     5

>> fprintf(fid, ['dat_path = ''', strrep(aze, '\', '/') '''\n'])
Error using fprintf
Invalid format.

@marius10p
Copy link
Contributor

Can you please try it without the strrep, so just

fprintf(fid, ['dat_path = ''', aze '''\n'])

@DradeAW
Copy link
Author

DradeAW commented Feb 12, 2021

I tried it, and it still crashes:

>> fid = fopen("/users/nsr/wyngaard/Documents/cells_tracking/0153/session_1/rec/test.py", 'w');
>> fprintf(fid, ['dat_path = ''', aze '''\n'])
Error using fprintf
Invalid format.

However, I managed to change the line so that it does work (using concatenation instead of an array):

>> fid = fopen("/users/nsr/wyngaard/Documents/cells_tracking/0153/session_1/rec/test.py", 'w');
>> fprintf(fid, 'dat_path = ''' + aze + '''\n')

ans =

    59

@marius10p
Copy link
Contributor

Does params.py look ok, and does it open in Phy? I'll try concatenation on my end too.

@DradeAW
Copy link
Author

DradeAW commented Feb 12, 2021

Yes params.py looks as it should, and it opens with Phy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants