-
Notifications
You must be signed in to change notification settings - Fork 77
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
Further granularity for JLD #65
Comments
I think you're looking for a custom serializer: https://github.com/JuliaIO/JLD.jl/blob/master/doc/jld.md#custom-serialization. You can define Since I don't think this is a FileIO issue, I'm closing this (but if you disagree, I can reopen). |
Thanks, This is more/less what I was looking for. I had missed that part in the docs... There still might be a small relation to FileIO: In the documented example, an Would there be a way of cascading the FileIO magic to |
It shouldn't, if the package that defines the |
Relevant to the previous point: see also the part in the docs about |
Yes, thanks, I did have the |
Ah---I found the reason why it just does not exactly what I want, and why I was looking for a FileIO solution. In the documented example, things work if I say something like obj4 = FileIO.load(filename, "somedata") but what I was looking for was a way to be able to say obj3 = FileIO.load(filename) which would need additional magic that files that require The parallel with FileIO would be that most standard formats have "unnamed" objects as well, e.g., |
You'd probably need to define a new file extension, and most likely give it a special magic #. |
Is there a way to add additional magic after This is assuming that FileIO will go for the longer magic match. |
I don't think that FileIO can (in the central repository) reasonably support "custom JLD content" as separate file types; after all, there are an infinite number of possible combinations of variable names, types, etc., and so you might define 3 different ones, I might define 5 different ones, etc. Only if there is some standard in widespread use would we consider such a thing. However, of course you can add this locally. But perhaps an easier option would be to write a function called |
Yes, that makes sense. It is funny, though, that I tend to save objects ( |
Right, but other people might save 20 different objects of the same type to a single file, using a different pathname for each. |
Hello,
I understand JLD is distinguished from HDF5, which is great. I my own packages I rely on JLD to store specific types (e.g., a GaussianMixtures::GMM). I believe JLD already handles most of what I want, but sometimes I'd like to call a constructor-specific hook for loading or saving. How should I handle this in the FileIO infrastructure.
To be more concrete, suppose I have a type like:
then I'd like to save only
T1.c
and upon loading call something likeT1(load(stream)["t1.c"])
. But it would be nice if this can be accomplished all from just loading a JLD-encoded file using FileIO magic.How would I go about that?
---david
The text was updated successfully, but these errors were encountered: