Skip to content

Commit

Permalink
Add copy and deepcopy methods
Browse files Browse the repository at this point in the history
Codestyle
  • Loading branch information
rosteen committed Jan 23, 2024
1 parent 88b2abd commit 0ff7bac
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions specutils/utils/wcs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ def __init__(self, *args, **kwargs):
self.original_unit = kwargs.pop("original_unit", "")
super().__init__(*args, **kwargs)

def copy(self):
"""
Return a shallow copy of the object.
Convenience method so user doesn't have to import the
:mod:`copy` stdlib module.
.. warning::
Use `deepcopy` instead of `copy` unless you know why you need a
shallow copy.
"""
return copy.copy(self)

def deepcopy(self):
"""
Return a deep copy of the object.
Convenience method so user doesn't have to import the
:mod:`copy` stdlib module.
"""
return copy.deepcopy(self)

def pixel_to_world(self, *args, **kwargs):
if self.original_unit == '':
return u.Quantity(super().pixel_to_world_values(*args, **kwargs))
Expand Down

0 comments on commit 0ff7bac

Please sign in to comment.