def bad_delta(): axis_1d = CoordAxis1D(wcs.Axis("RM", "rad/m**2")) # delta < 0.0 is bad ref_coord = RefCoord(float(1.0), float(2.0)) axis_1d.function = CoordFunction1D(int(100), -0.01, ref_coord) return chunk.CustomWCS(axis_1d)
def get_custom_wcs(self): axis = wcs.Axis('Foo') axis1d = wcs.CoordAxis1D(axis) axis1d.function = wcs.CoordFunction1D(int(5), 1.0, wcs.RefCoord(1.0, 1.0)) custom = chunk.CustomWCS(axis1d) return custom
def bad_range_wcs(): ctype = "RM" unit = "rad/m^2" error = None start = RefCoord(float(0.9), float(1.1)) end = RefCoord(float(10.9), float(1.1)) range = CoordRange1D(start, end) axis_1d = CoordAxis1D(wcs.Axis(ctype, unit), error, range) return chunk.CustomWCS(axis_1d)
def get_test_function_with_range(ctype, unit, px, sx, nx, ds): error = None start = RefCoord(float(0.9), float(1.1)) end = RefCoord(float(10.9), float(11.1)) range = CoordRange1D(start, end) axis_1d = CoordAxis1D(wcs.Axis(ctype, unit), error, range) ref_coord = RefCoord(px, sx) axis_1d.function = CoordFunction1D(nx, ds, ref_coord) custom_wcs = chunk.CustomWCS(axis_1d) return custom_wcs
def bad_bounds_wcs(): ctype = "RM" unit = "rad/m^2" error = None range = None c1 = RefCoord(float(0.9), float(1.1)) c2 = RefCoord(float(10.9), float(1.1)) bounds = CoordBounds1D() bounds.samples.append(CoordRange1D(c1, c2)) axis_1d = CoordAxis1D(wcs.Axis(ctype, unit), error, range, bounds) return chunk.CustomWCS(axis_1d)
def get_test_function_with_function(ctype, unit, px, sx, nx, ds): error = None range = None bounds = None naxis = int(1) delta = float(2.5) ref_coord = wcs.RefCoord(float(1.0), float(2.0)) function = CoordFunction1D(naxis, delta, ref_coord) axis_1d = CoordAxis1D(wcs.Axis(ctype, unit), error, range, bounds, function) ref_coord = RefCoord(px, sx) axis_1d.function = CoordFunction1D(nx, ds, ref_coord) custom_wcs = chunk.CustomWCS(axis_1d) return custom_wcs
def bad_function_wcs(): ctype = "RM" unit = "rad/m^2" error = None range = None c1 = RefCoord(float(0.9), float(1.1)) c2 = RefCoord(float(10.9), float(1.1)) bounds = CoordBounds1D() bounds.samples.append(CoordRange1D(c1, c2)) naxis = 1 delta = 0.0 ref_coord = RefCoord(float(0.9), float(1.1)) func = CoordFunction1D(naxis, delta, ref_coord) axis_1d = CoordAxis1D(wcs.Axis(ctype, unit), error, range, bounds, func) return chunk.CustomWCS(axis_1d)
def bad_range_wcs(): px = float(0.5) sx = float(54321.0) nx = 200 ds = float(0.01) axis_1d = wcs.CoordAxis1D(wcs.Axis("RM", "rad/m**2")) # divide into 2 samples with a gap between c1 = RefCoord(px, sx) c2 = RefCoord(0.0, 0.0) c3 = RefCoord(px + nx * 0.66, sx + nx * ds * 0.66) c4 = RefCoord(px + nx, sx + nx * ds) axis_1d.bounds = CoordBounds1D() axis_1d.bounds.samples.append(CoordRange1D(c1, c3)) axis_1d.bounds.samples.append(CoordRange1D(c4, c2)) return chunk.CustomWCS(axis_1d)
def get_test_function_with_bounds_3_samples(ctype, unit, px, sx, nx, ds): error = None range = None start = RefCoord(float(0.8), float(1.1)) end = RefCoord(float(10.8), float(11.1)) b_range_1 = CoordRange1D(start, end) start = RefCoord(float(0.9), float(1.2)) end = RefCoord(float(10.9), float(11.2)) b_range_2 = CoordRange1D(start, end) start = RefCoord(float(-0.9), float(-1.2)) end = RefCoord(float(0.6), float(0.2)) b_range_3 = CoordRange1D(start, end) samples = caom_util.TypedList(CoordRange1D, b_range_1, b_range_2, b_range_3) bounds = CoordBounds1D(samples) axis_1d = wcs.CoordAxis1D(wcs.Axis(ctype, unit), error, range, bounds) ref_coord = wcs.RefCoord(px, sx) axis_1d.function = wcs.CoordFunction1D(nx, ds, ref_coord) custom_wcs = chunk.CustomWCS(axis_1d) return custom_wcs
def get_test_function(ctype, unit, px, sx, nx, ds): axis_1d = CoordAxis1D(wcs.Axis(ctype, unit)) ref_coord = RefCoord(px, sx) axis_1d.function = CoordFunction1D(nx, ds, ref_coord) custom_wcs = chunk.CustomWCS(axis_1d) return custom_wcs