-
Notifications
You must be signed in to change notification settings - Fork 7
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
optimize get streams for BrukerTiffSinglePlaneImagingExtractor
#344
Conversation
for more information, see https://pre-commit.ci
…streams' into improve_bruker_get_streams
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.
Looks good, thanks @h-mayorquin. Should we add this in the changelog?
Done. |
…streams' into improve_bruker_get_streams
channel_names = set() | ||
for event, elem in ElementTree.iterparse(xml_file_path, events=("start",)): | ||
if elem.tag == "Frame": | ||
# Get all the sub-elements in this Frame element | ||
for subelem in elem: | ||
if subelem.tag == "File": | ||
channel_names.add(subelem.attrib["channelName"]) | ||
|
||
break | ||
|
||
return channel_names |
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.
Would it make sense to switch to lxml
as in #346 ?
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.
Good idea. Do you mind if I switch it in #346 just to avoid merging conficts? All of these PR are linked.
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.
Yeah, sounds good. thanks!
This uses lazy xml reading instead of parsing the whole xml file. On my data this implementation is 60 times faster.