Open AKuederle opened 9 months ago
Thank you @AKuederle for these suggestions. I have a few questions to make sure I grasp this correctly:
Path
suggestion, do you mean doing this?In the beginning, define the path like this:
from pathlib import Path
pp = "P25"
path = Path("COPY-YOUR-ADDRESS-HERE")
conditions = ['sitting', 'arithmetic', 'recovery']
devices = ["kyto", "empatica", "vu"]
criterion = "vu"
Then, I also need modify the functions slightly to incorporate this. For instance, in the individual.import_data()
function, instead of path_vu = path + pp + '_' + "vu" + '.txt'
, I modify it to path_vu = path / f"{pp}_vu.txt"
.
Is this what you are suggesting to be done?
Regarding the path thing:
I would usggest to use Path
internally everywhere and all functions that can take a file-path or directory as input, to support both str and Path. So when the user passes as str you convert it to path. This makes sure that you don't have to deal with OS differences internally and you allow the user to also benefit from using Path (but they don't have to)
Regarding huge files: While this is a matter of preference, most people structure their functions in multiple smaller files based on categories (e.g. plotting, utils, io, loading, stats, ...). And then depending on the project, the relevant methods are reexported in user facing files to separate the internal structure from the import structures for users. For example see scikit-learn: https://github.com/scikit-learn/scikit-learn/tree/main/sklearn/cluster
Here the implementaiton is split in smaller files to easier find things, but then user facing functions are re-imported in the top-level init to provide more convenient import syntax
Path
; related commit.
Overall the code quality looks great, but here are a couple of smaller things that could be improved:
Path
instead of strings for file/folder paths -> This will solve a bunch of issues caused by the differences between operating systems. For example it would make.replace('\\', '/')
obsolote in the exampleindividual
file)ruff
orblack