refactor: 🎨 streamline the code#75
Conversation
|
The reason why I didn't modify the first two functions is to easily compare this code with the official code. Intan is not good at maintaining their code. I agree that their code can be refactored but then it will be hard to track the difference if they make changes in the future. |
Co-authored-by: Tolga Dincer <tolgadincer@gmail.com>
| signal = np.memmap(file_path, dtype=np.int16) | ||
|
|
||
| if file_expr == "*": | ||
| file_paths = list(folder.glob("[!info|!time|!Zone]*")) |
There was a problem hiding this comment.
If I recall correctly, this is not how the Unix pattern matching works. [!info] would match any character that's not i, n, f, or o. Please check me on this.
There was a problem hiding this comment.
@dimitri-yatsenko. Not sure, but you may be right. I'll look into it but I'll revert this change in the meantime.
|
Just a comment, @JaerongA. What |
Thanks @dimitri-yatsenko. That's good to know. |
fix constant from 255 to 256 Co-authored-by: Tolga Dincer <tolgadincer@gmail.com>
|
@dimitri-yatsenko Your last point has been addressed. Shall we merge this PR? |
Co-authored-by: Dimitri Yatsenko <dimitri@datajoint.com>
Co-authored-by: Dimitri Yatsenko <dimitri@datajoint.com>
| # Get recording data | ||
| rhs_data["recordings"] = {} | ||
|
|
||
| for file_path in sorted(file_paths): |
There was a problem hiding this comment.
@JaerongA This for loop should be run with the condition of if len(file_paths):. It is to support the file_expr keyword. For instance if file_expr="time.dat", this code will fail because file_paths will be an empty list. Let's fix this and merge the PR.
There was a problem hiding this comment.
@tdincer I thought file_expre was intended for selecting data channels only. I've made some revisions to fix that but right now, timestamps and info will always be read by default. Please feel free to modify if that wasn't your intention.
|
Thank you @dimitri-yatsenko and @JaerongA. I'm merging this PR. I'll make a couple of tweaks when I'm pushing the code to the main branch. |
"*"