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

Avoid duplication of functionality to retrieve traces in segmentation extractor #209

Open
h-mayorquin opened this issue Sep 1, 2022 · 2 comments

Comments

@h-mayorquin
Copy link
Collaborator

Opening an issue to keep track of this:

As discussed in #200 and #207 the SegmentationExtractor class has two functions that duplicated the same functionality. get_traces_dict and get_traces and, as illustrated in the referenced issue, this has lead to problems. Maybe we should follow the strongest dictum in the following sentence of the zen of python

There should be one-- and preferably only one --obvious way to do it.

I am opening this issue to keep track of the discussion of whether we should this and how.

@CodyCBakerPhD
Copy link
Member

get_traces_dict -> get_traces_types or get_traces_names, both return a list of names that used to be keys of the dict. This would not return anything for the case where a trace is not set to the extractor.

get_traces(..., name="...") works as-is, but you can now loop over all the traces like

for trace_name in segmentation.get_traces_names:
    segmentation.get_traces(..., name=trace_name)

@h-mayorquin
Copy link
Collaborator Author

I think that works.

What about the opposite approach of getting rid of the getting traces name and keep the dictionary? That way, everything pertaining traces is in a single namespace in a data structure that makes sense for keeping traces (after all you do require both the name and the trace). In other words, why add an extra method to SegmentationExtractor when the python dictionary already represents the data appropriately? What do you think?

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

No branches or pull requests

2 participants