You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does the readimc API for MCDFile allow for reading mcd files directly from a zipped state? Our group often compresses these files to save space, and this functionality would be great for faster data processing.
The text was updated successfully, but these errors were encountered:
matt-sd-watson
changed the title
Aupport for reading directly from zip files
Support for reading directly from zip files
Oct 30, 2023
This is currently not supported, but I think it would be a great addition. Tagging @Milad4849 here, the current maintainer.
With that being said, MCDFile just operates with standard file handles, so you could try to extend the MCDFile class yourself:
classMyMCDFile(MCDFile):
defopen(self) ->None:
ifself._path.name.suffix==".zip":
self._fh=ZipFile(self._path).open("myfile.mcd", mode="rb")
self._schema_xml=self._read_schema_xml()
self._slides=MCDParser(self._schema_xml).parse_slides()
else:
super().open() # call original MCDFile.open function
Note that this is untested. Not sure whether this will work as expected, especially because it will likely cause problems with memory mapping (e.g. here and here), but it may provide a starting point - I'm sure @Milad4849 would welcome pull requests! For example, one could think of modifying MCDFile.__init__ to also accept file handles, and only use memory mapping for uncompressed data.
Does the readimc API for
MCDFile
allow for reading mcd files directly from a zipped state? Our group often compresses these files to save space, and this functionality would be great for faster data processing.The text was updated successfully, but these errors were encountered: