def __init__(self, normal, center, north_vector=None, ds=None, field_parameters=None, data_source=None): validate_3d_array(normal) validate_center(center) if north_vector is not None: validate_3d_array(north_vector) validate_object(ds, Dataset) validate_object(field_parameters, dict) validate_object(data_source, YTSelectionContainer) YTSelectionContainer2D.__init__(self, 4, ds, field_parameters, data_source) self._set_center(center) self.set_field_parameter('center',center) # Let's set up our plane equation # ax + by + cz + d = 0 self.orienter = Orientation(normal, north_vector = north_vector) self._norm_vec = self.orienter.normal_vector self._d = -1.0 * np.dot(self._norm_vec, self.center) self._x_vec = self.orienter.unit_vectors[0] self._y_vec = self.orienter.unit_vectors[1] # First we try all three, see which has the best result: self._rot_mat = np.array([self._x_vec,self._y_vec,self._norm_vec]) self._inv_mat = np.linalg.pinv(self._rot_mat) self.set_field_parameter('cp_x_vec',self._x_vec) self.set_field_parameter('cp_y_vec',self._y_vec) self.set_field_parameter('cp_z_vec',self._norm_vec)
def __init__(self, axis, coord, center=None, ds=None, field_parameters=None, data_source=None): YTSelectionContainer2D.__init__(self, axis, ds, field_parameters, data_source) self._set_center(center) self.coord = coord
def __init__( self, axis, coord, center=None, ds=None, field_parameters=None, data_source=None ): validate_axis(ds, axis) validate_float(coord) # center is an optional parameter if center is not None: validate_center(center) validate_object(ds, Dataset) validate_object(field_parameters, dict) validate_object(data_source, YTSelectionContainer) YTSelectionContainer2D.__init__(self, axis, ds, field_parameters, data_source) self._set_center(center) self.coord = coord