-
Notifications
You must be signed in to change notification settings - Fork 0
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
Change main structure of the repo #8
Conversation
Here on Canva I am making a sort of flow chart describing the desired package structure starting from the source code in MATLAB. The current version is attached as an image. I would like first to set the overall design and then later fill the gaps (methods implementations). I want to focus first on the pipeline regarding spatial and temporal frequency which is currently in use. |
Related to the issue #11 |
Here a description of the overall new structure of the project. Many classes and methods are now just drafts and placeholders to be filled afterwards. Main: the entry pointThe entry point is Modules and objectsThe project is divided into folders which contain relevant modules.
Folder structure
P.S. I am also addressing issue #9 |
Add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done @lauraporta! I really like how you have structured the project, and I can definitely see adopting a similar structure for my projects too.
I have left some comments (most of them nitpicky, feel free to ignore).
On a higher level, it's a bit confusing to have config
(as in config.yaml
), Config
(the class), and Options
, especially the first two. Consider renaming the Config
class.
load_suite2p/main.py
Outdated
+ "Please check the documentation." | ||
) | ||
# load data | ||
config, data = load_data(folder_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
load_data
returns first config
, then data
. On the other hand, the order for defining PhotonData
and Analysis
objects is the exact opposite: first data
, then config
. I would make the order the same in all instances, to avoid user confusion
load_suite2p/objects/options.py
Outdated
@@ -0,0 +1,46 @@ | |||
class Options: | |||
"""Class with the options to analize data from suite2p and registers2p. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: analyze
@@ -121,3 +121,10 @@ def check_if_file_exists(self) -> bool: | |||
True if folder exists, False otherwise | |||
""" | |||
return os.path.exists(self.get_path()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use pathlib for consistency, e.g. return self.get_path().exists()
.
If you specifically want to check whether the path is a directory, use: return self.get_path().is_dir()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if this function check for a folder (not a file), consider renaming the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!
load_suite2p/load/load_data.py
Outdated
return config, data_raw | ||
|
||
|
||
def configure(folder_name: str) -> Config: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming this function to sth more specific, e.g. add_folder_to_config
from .options import Options | ||
|
||
|
||
class Config: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's confusing for me that that this class has the same name as the config.yaml
, though afaik it represents something completely different.
@@ -4,7 +4,7 @@ | |||
from .parser import Parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a stdlib module named parser
. Consider modifying tha name of your parser module, to avoid overriding the stdlib one.
self._parser = Parser01(self.folder_name, self.config) | ||
if self.original_config["parser"] == "Parser2pRSP": | ||
logging.debug("Parsing folder name using Parser2pRSP") | ||
self._parser = Parser2pRSP(self.folder_name, self.original_config) | ||
else: | ||
logging.debug( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be logging.error
?
from ..objects.photon_data import PhotonData | ||
|
||
|
||
class SpatialFrequencyTemporalFrequency: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a shorter name for this class could be SpatialFreqTemporalFreq
?
|
||
|
||
class Specifications: | ||
"""The class :class:`Config` represents the configuration of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to also change the name in the docstring
load_suite2p/load/load_data.py
Outdated
|
||
|
||
def get_specifications(folder_name: str) -> Specifications: | ||
"""Create configuration object. It reads the configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edit docsting
I want to simplify the project by having all the components in one repository.
Therefore I am starting to set the folder
analysis/
which is going to contain the methods to be used to analyse the data.I committed changes with a scaffold of the analysis methods (to be implemented) and a draft if the
formatted_data
class.