Skip to content

Commit

Permalink
ape 14 start
Browse files Browse the repository at this point in the history
  • Loading branch information
nden committed Mar 26, 2018
1 parent fac910c commit c262e50
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions gwcs/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,3 +545,53 @@ def footprint(self, bounding_box=None, center=False):
vertices = _toindex(vertices)
result = self.__call__(*vertices, **{'with_bounding_box': False})
return np.asarray(result)

# APE 14 implementation

def pixel_n_dim(self):
return self.input_frame.naxes

def world_n_dim(self):
return self.output_frame.naxes

def pixel_shape(self):
return None

def pixel_bounds(self):
return self.bounding_box

def world_axis_physical_types(self):
# Need to match with UCD type
return self.output_frame.axes_types

def world_axis_units(self):
return self.output_frame.unit

def axis_correlation_matrix(self):
return is_separable(self.forward_transform)

def pixel_to_world_values(self, *pixel_arrays):
# need **kwargs
return self.__call__(*pixel_arrays, **kwargs)

def world_to_pixel_values(self, *world_arrays):
# needs **kwargs
return self.invert(*world_arrays, **kwargs)

@property
def world_axis_object_components(self):
components = []
outframe = self.output_frame
if isinstance(outframe, cf.CompoundFrame):
for frame in outframe.frames:
components.append(self.output_frame.axes_names[axis])
return components

@property
def world_axis_object_classes(self):
classes = {}
for axis in self.output_frame.axes_order:
classes[self.output_frame.axes_names[axis]] = ()
return classes


0 comments on commit c262e50

Please sign in to comment.