Skip to content

Commit

Permalink
improved copy so that _data are not shared between copied objects
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabytprowe committed Aug 9, 2012
1 parent 99048c2 commit ac47c43
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions galsim/base.py
Expand Up @@ -94,9 +94,12 @@ def copy(self):
Gaussian (for example), the copy will also be a Gaussian, and can thus call
the methods that are not in GSObject, but are in Gaussian (e.g. getSigma).
"""
sbp = self.SBProfile.__class__(self.SBProfile)
ret = GSObject(sbp)
import copy
new_sbp = self.SBProfile.__class__(self.SBProfile)
new_data = copy.copy(self._data)
ret = GSObject(new_sbp)
ret.__class__ = self.__class__
ret._data = new_data
return ret

# Now define direct access to all SBProfile methods via calls to self.SBProfile.method_name()
Expand Down

0 comments on commit ac47c43

Please sign in to comment.