-
Notifications
You must be signed in to change notification settings - Fork 21
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
memh5.from_group
does not have the expected behavior
#190
Comments
This is a user error. From_group intentionally keeps its data in place, ie does not make a deep copy. I have to look at the docs, but there definitely should be a way to do what you want.
…Sent from my iPhone
On Oct 17, 2021, at 12:46 PM, Calvin Leung ***@***.***> wrote:
This bug was discovered downstream (in baseband_analysis) whose main data container BBData inherits from BasicCont. I tried to make a new, independent instance of a BBData object that lives in memory. I tried doing this using from_group but it looks like the new object created is, in fact, not a deep copy of the original (even though from_group calls something which is supposed to be deep_group_copy).
Modifying the datasets of the new object modifies the original. Is this the expected behavior? This is potentially dangerous for downstream analysis; tagging @jrs65<https://github.com/jrs65> and @kiyo-masui<https://github.com/kiyo-masui> because I'm so out of my depth here.
[image]<https://user-images.githubusercontent.com/42367504/137636700-bdbb21b5-311d-4c60-80bf-0d42df84e0b3.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#190>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AADBPH3MN2P2R3TRZ5NF6NTUHL4VPANCNFSM5GFAD2TQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Took a look at the code and believe it or not there doesn't seem to be an official way to do what you want. That said, what you are doing is definitely wrong, and there are a could things that are less wrong that might work. Try the following:
or maybe
Both of these require importing |
For CHIME cosmology we built this functionality in at a higher level of abstraction into draco.core.containers.ContainerBase.copy, so we've never really noticed it was missing. I think we could feasibly move the functionality down to a lower level (probably BasicCont) though if that would be helpful. It would require a little bit of refactoring, but provided the API remained the same I don't think we would care. |
Unfortunately neither of @kiyo-masui's suggestions do the trick. The former suggestion is actually what's being done in
|
Seems like
Is this intentional? If not, can we simply do something like |
That's baffling. Digging through many layers of git blame, this has been the same since I first wrote it 8 years ago... inexcusable. Its possible that the behavior of I would advocate also adding draco's |
I think the suggested fix is sufficient, in the sense that the other parts of |
I'm not sure it's really a bug here, but it is at least poor naming. I think it's effectively a deep copy when doing hdf5 <-> memory, but not when doing memory -> memory. Unfortunately I'm going to veto Gavin's fix as is. Regardless of whether it's a bug or not, it's been in there way too long and I imagine parts of our pipeline will implicitly depend on the way it works, and I'm really not keen on having to go and find them. I would mostly recommend writing an actual I would also be okay if Gavin's fix was hidden behind an option to the |
This bug was discovered downstream (in
baseband_analysis
) whose main data containerBBData
inherits fromBasicCont
. I tried to make a new, independent instance of aBBData
object that lives in memory. I tried doing this usingfrom_group
but it looks like the new object created is, in fact, not a deep copy of the original (even thoughfrom_group
calls something which is supposed to bedeep_group_copy
).Modifying the datasets of the new object modifies the original. Is this the expected behavior? This is potentially dangerous for downstream analysis; tagging @jrs65 and @kiyo-masui because I'm so out of my depth here.
The text was updated successfully, but these errors were encountered: