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

Can't copy or deepcopy a Beam #71

Open
ttshimiz opened this issue Dec 19, 2018 · 1 comment
Open

Can't copy or deepcopy a Beam #71

ttshimiz opened this issue Dec 19, 2018 · 1 comment

Comments

@ttshimiz
Copy link

ttshimiz commented Dec 19, 2018

When using copy.copy(Beam) or copy.deepcopy(Beam) the returned object loses all of its attributes such as Beam.major and Beam.minor.
Sample code:

from radio_beam import Beam
import astropy.units as u

beam = Beam(major=2*u.arcsec)
beam2 = copy.copy(beam)

I think the fix is fairly simple by defining a new __copy__ and __deepcopy__ method for the Beam class.

@keflavich
Copy link
Contributor

This is probably because Beam is a Quantity object and there's something related to numpy array copying that requires a __new__ method, or something like that.

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

No branches or pull requests

2 participants