1# This file was automatically generated by SWIG (http://www.swig.org). 2# Version 4.0.2 3# 4# Do not make changes to this file unless you know what you are doing--modify 5# the SWIG interface file instead. 6 7from sys import version_info as _swig_python_version_info 8if _swig_python_version_info < (2, 7, 0): 9 raise RuntimeError("Python 2.7 or later required") 10 11# Import the low-level C/C++ module 12if __package__ or "." in __name__: 13 from . import _util 14else: 15 import _util 16 17try: 18 import builtins as __builtin__ 19except ImportError: 20 import __builtin__ 21 22def _swig_repr(self): 23 try: 24 strthis = "proxy of " + self.this.__repr__() 25 except __builtin__.Exception: 26 strthis = "" 27 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) 28 29 30def _swig_setattr_nondynamic_instance_variable(set): 31 def set_instance_attr(self, name, value): 32 if name == "thisown": 33 self.this.own(value) 34 elif name == "this": 35 set(self, name, value) 36 elif hasattr(self, name) and isinstance(getattr(type(self), name), property): 37 set(self, name, value) 38 else: 39 raise AttributeError("You cannot add instance attributes to %s" % self) 40 return set_instance_attr 41 42 43def _swig_setattr_nondynamic_class_variable(set): 44 def set_class_attr(cls, name, value): 45 if hasattr(cls, name) and not isinstance(getattr(cls, name), property): 46 set(cls, name, value) 47 else: 48 raise AttributeError("You cannot add class attributes to %s" % cls) 49 return set_class_attr 50 51 52def _swig_add_metaclass(metaclass): 53 """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" 54 def wrapper(cls): 55 return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) 56 return wrapper 57 58 59class _SwigNonDynamicMeta(type): 60 """Meta class to enforce nondynamic attributes (no new attributes) for a class""" 61 __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) 62 63 64 65def log_init(level): 66 return _util.log_init(level) 67 68def log_get_level(): 69 return _util.log_get_level() 70 71def log_set_level(lvl): 72 return _util.log_set_level(lvl) 73class coadd_t(object): 74 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 75 __repr__ = _swig_repr 76 img = property(_util.coadd_t_img_get, _util.coadd_t_img_set) 77 weight = property(_util.coadd_t_weight_get, _util.coadd_t_weight_set) 78 W = property(_util.coadd_t_W_get, _util.coadd_t_W_set) 79 H = property(_util.coadd_t_H_get, _util.coadd_t_H_set) 80 wcs = property(_util.coadd_t_wcs_get, _util.coadd_t_wcs_set) 81 resample_func = property(_util.coadd_t_resample_func_get, _util.coadd_t_resample_func_set) 82 resample_token = property(_util.coadd_t_resample_token_get, _util.coadd_t_resample_token_set) 83 84 def __init__(self): 85 _util.coadd_t_swiginit(self, _util.new_coadd_t()) 86 __swig_destroy__ = _util.delete_coadd_t 87 88# Register coadd_t in _util: 89_util.coadd_t_swigregister(coadd_t) 90 91 92def coadd_new(W, H): 93 return _util.coadd_new(W, H) 94 95def coadd_new_from_wcs(wcs): 96 return _util.coadd_new_from_wcs(wcs) 97 98def coadd_set_lanczos(co, Lorder): 99 return _util.coadd_set_lanczos(co, Lorder) 100 101def coadd_add_image(c, img, weightimg, weight, wcs): 102 return _util.coadd_add_image(c, img, weightimg, weight, wcs) 103 104def coadd_divide_by_weight(c, badpix): 105 return _util.coadd_divide_by_weight(c, badpix) 106 107def coadd_get_snapshot(c, outimg, badpix): 108 return _util.coadd_get_snapshot(c, outimg, badpix) 109 110def coadd_free(c): 111 return _util.coadd_free(c) 112 113def coadd_debug(co): 114 return _util.coadd_debug(co) 115 116def coadd_create_weight_image_from_range(img, W, H, lowval, highval): 117 return _util.coadd_create_weight_image_from_range(img, W, H, lowval, highval) 118 119def coadd_weight_image_mask_value(img, W, H, weight, badval): 120 return _util.coadd_weight_image_mask_value(img, W, H, weight, badval) 121class lanczos_args_t(object): 122 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 123 __repr__ = _swig_repr 124 order = property(_util.lanczos_args_t_order_get, _util.lanczos_args_t_order_set) 125 weighted = property(_util.lanczos_args_t_weighted_get, _util.lanczos_args_t_weighted_set) 126 127 def __init__(self): 128 _util.lanczos_args_t_swiginit(self, _util.new_lanczos_args_t()) 129 __swig_destroy__ = _util.delete_lanczos_args_t 130 131# Register lanczos_args_t in _util: 132_util.lanczos_args_t_swigregister(lanczos_args_t) 133 134 135def lanczos(x, order): 136 return _util.lanczos(x, order) 137 138def nearest_resample_f(px, py, img, weightimg, W, H, out_wt, token): 139 return _util.nearest_resample_f(px, py, img, weightimg, W, H, out_wt, token) 140 141def lanczos_resample_f(px, py, img, weightimg, W, H, out_wt, token): 142 return _util.lanczos_resample_f(px, py, img, weightimg, W, H, out_wt, token) 143 144def lanczos_resample_unw_sep_f(px, py, img, W, H, token): 145 return _util.lanczos_resample_unw_sep_f(px, py, img, W, H, token) 146 147def nearest_resample_d(px, py, img, weightimg, W, H, out_wt, token): 148 return _util.nearest_resample_d(px, py, img, weightimg, W, H, out_wt, token) 149 150def lanczos_resample_d(px, py, img, weightimg, W, H, out_wt, token): 151 return _util.lanczos_resample_d(px, py, img, weightimg, W, H, out_wt, token) 152TRUE = _util.TRUE 153FALSE = _util.FALSE 154 155def fit_sip_coefficients(starxyz, fieldxy, weights, M, tanin1, sip_order, inv_order, sipout): 156 return _util.fit_sip_coefficients(starxyz, fieldxy, weights, M, tanin1, sip_order, inv_order, sipout) 157 158def wcs_shift(wcs, xs, ys): 159 return _util.wcs_shift(wcs, xs, ys) 160 161def fit_sip_wcs(starxyz, fieldxy, weights, M, tanin, sip_order, inv_order, doshift, sipout): 162 return _util.fit_sip_wcs(starxyz, fieldxy, weights, M, tanin, sip_order, inv_order, doshift, sipout) 163 164def fit_sip_wcs_2(starxyz, fieldxy, weights, M, sip_order, inv_order, W, H, crpix_center, crpix, doshift, sipout): 165 return _util.fit_sip_wcs_2(starxyz, fieldxy, weights, M, sip_order, inv_order, W, H, crpix_center, crpix, doshift, sipout) 166 167def fit_tan_wcs_move_tangent_point(starxyz, fieldxy, N, crpix, tanin, tanout): 168 return _util.fit_tan_wcs_move_tangent_point(starxyz, fieldxy, N, crpix, tanin, tanout) 169 170def fit_tan_wcs_move_tangent_point_weighted(starxyz, fieldxy, weights, N, crpix, tanin, tanout): 171 return _util.fit_tan_wcs_move_tangent_point_weighted(starxyz, fieldxy, weights, N, crpix, tanin, tanout) 172 173def fit_tan_wcs(starxyz, fieldxy, nobjs, wcstan, p_scale): 174 return _util.fit_tan_wcs(starxyz, fieldxy, nobjs, wcstan, p_scale) 175 176def fit_tan_wcs_weighted(starxyz, fieldxy, weights, N, tan, p_scale): 177 return _util.fit_tan_wcs_weighted(starxyz, fieldxy, weights, N, tan, p_scale) 178 179def print_array(arr): 180 return _util.print_array(arr) 181 182def an_hist2d(py_arrx, py_arry, py_hist, xlo, xhi, ylo, yhi): 183 return _util.an_hist2d(py_arrx, py_arry, py_hist, xlo, xhi, ylo, yhi) 184 185def flat_percentile_f(np_arr, pct): 186 return _util.flat_percentile_f(np_arr, pct) 187 188def flat_median_f(np_arr): 189 return _util.flat_median_f(np_arr) 190 191def median_smooth(py_image, py_mask, halfbox, py_smooth): 192 return _util.median_smooth(py_image, py_mask, halfbox, py_smooth) 193L = _util.L 194 195def lanczos5_interpolate(np_ixi, np_iyi, np_dx, np_dy, loutputs, linputs): 196 return _util.lanczos5_interpolate(np_ixi, np_iyi, np_dx, np_dy, loutputs, linputs) 197 198def lanczos3_interpolate(np_ixi, np_iyi, np_dx, np_dy, loutputs, linputs): 199 return _util.lanczos3_interpolate(np_ixi, np_iyi, np_dx, np_dy, loutputs, linputs) 200 201def lanczos5_filter(py_dx, py_f): 202 return _util.lanczos5_filter(py_dx, py_f) 203 204def lanczos3_filter(py_dx, py_f): 205 return _util.lanczos3_filter(py_dx, py_f) 206 207def lanczos3_filter_table(py_dx, py_f, rangecheck): 208 return _util.lanczos3_filter_table(py_dx, py_f, rangecheck) 209 210def lanczos_shift_image_c(py_img, py_weight, py_outimg, py_outweight, order, dx, dy): 211 return _util.lanczos_shift_image_c(py_img, py_weight, py_outimg, py_outweight, order, dx, dy) 212 213 214def lanczos_shift_image(img, dx, dy, order=3, weight=None, 215 outimg=None, outweight=None): 216 img = img.astype(float) 217 if weight is not None: 218 weight = weight.astype(float) 219 assert(img.shape == weight.shape) 220 if outimg is None: 221 outimg = np.zeros_like(img) 222 if outweight is not None: 223 assert(outweight.shape == img.shape) 224 225# print 'outweight:', outweight 226 227 lanczos_shift_image_c(img, weight, outimg, outweight, order, dx, dy) 228 if outweight is None: 229 return outimg 230 return outimg,outweight 231 232DEFAULT_INDEX_JITTER = _util.DEFAULT_INDEX_JITTER 233class index_t(object): 234 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 235 __repr__ = _swig_repr 236 codekd = property(_util.index_t_codekd_get, _util.index_t_codekd_set) 237 quads = property(_util.index_t_quads_get, _util.index_t_quads_set) 238 starkd = property(_util.index_t_starkd_get, _util.index_t_starkd_set) 239 fits = property(_util.index_t_fits_get, _util.index_t_fits_set) 240 indexfn = property(_util.index_t_indexfn_get, _util.index_t_indexfn_set) 241 indexname = property(_util.index_t_indexname_get, _util.index_t_indexname_set) 242 indexid = property(_util.index_t_indexid_get, _util.index_t_indexid_set) 243 healpix = property(_util.index_t_healpix_get, _util.index_t_healpix_set) 244 hpnside = property(_util.index_t_hpnside_get, _util.index_t_hpnside_set) 245 index_jitter = property(_util.index_t_index_jitter_get, _util.index_t_index_jitter_set) 246 cutnside = property(_util.index_t_cutnside_get, _util.index_t_cutnside_set) 247 cutnsweep = property(_util.index_t_cutnsweep_get, _util.index_t_cutnsweep_set) 248 cutdedup = property(_util.index_t_cutdedup_get, _util.index_t_cutdedup_set) 249 cutband = property(_util.index_t_cutband_get, _util.index_t_cutband_set) 250 cutmargin = property(_util.index_t_cutmargin_get, _util.index_t_cutmargin_set) 251 circle = property(_util.index_t_circle_get, _util.index_t_circle_set) 252 cx_less_than_dx = property(_util.index_t_cx_less_than_dx_get, _util.index_t_cx_less_than_dx_set) 253 meanx_less_than_half = property(_util.index_t_meanx_less_than_half_get, _util.index_t_meanx_less_than_half_set) 254 index_scale_upper = property(_util.index_t_index_scale_upper_get, _util.index_t_index_scale_upper_set) 255 index_scale_lower = property(_util.index_t_index_scale_lower_get, _util.index_t_index_scale_lower_set) 256 dimquads = property(_util.index_t_dimquads_get, _util.index_t_dimquads_set) 257 nstars = property(_util.index_t_nstars_get, _util.index_t_nstars_set) 258 nquads = property(_util.index_t_nquads_get, _util.index_t_nquads_set) 259 260 def __init__(self): 261 _util.index_t_swiginit(self, _util.new_index_t()) 262 __swig_destroy__ = _util.delete_index_t 263 264# Register index_t in _util: 265_util.index_t_swigregister(index_t) 266 267 268def index_dimquads(indx): 269 return _util.index_dimquads(indx) 270 271def index_overlaps_scale_range(indx, quadlo, quadhi): 272 return _util.index_overlaps_scale_range(indx, quadlo, quadhi) 273 274def index_is_within_range(indx, ra, dec, radius_deg): 275 return _util.index_is_within_range(indx, ra, dec, radius_deg) 276 277def index_get_meta(filename, indx): 278 return _util.index_get_meta(filename, indx) 279 280def index_is_file_index(filename): 281 return _util.index_is_file_index(filename) 282 283def index_get_quad_filename(indexname): 284 return _util.index_get_quad_filename(indexname) 285 286def index_get_qidx_filename(indexname): 287 return _util.index_get_qidx_filename(indexname) 288INDEX_ONLY_LOAD_METADATA = _util.INDEX_ONLY_LOAD_METADATA 289 290def index_get_quad_dim(index): 291 return _util.index_get_quad_dim(index) 292 293def index_get_code_dim(index): 294 return _util.index_get_code_dim(index) 295 296def index_nquads(index): 297 return _util.index_nquads(index) 298 299def index_nstars(index): 300 return _util.index_nstars(index) 301 302def index_build_from(codekd, quads, starkd): 303 return _util.index_build_from(codekd, quads, starkd) 304 305def index_load(indexname, flags, dest): 306 return _util.index_load(indexname, flags, dest) 307 308def index_unload(index): 309 return _util.index_unload(index) 310 311def index_reload(index): 312 return _util.index_reload(index) 313 314def index_close_fds(index): 315 return _util.index_close_fds(index) 316 317def index_close(index): 318 return _util.index_close(index) 319 320def index_free(index): 321 return _util.index_free(index) 322 323def index_get_missing_cut_params(indexid, hpnside, nsweep, dedup, margin, band): 324 return _util.index_get_missing_cut_params(indexid, hpnside, nsweep, dedup, margin, band) 325class quadfile_t(object): 326 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 327 __repr__ = _swig_repr 328 numquads = property(_util.quadfile_t_numquads_get, _util.quadfile_t_numquads_set) 329 numstars = property(_util.quadfile_t_numstars_get, _util.quadfile_t_numstars_set) 330 dimquads = property(_util.quadfile_t_dimquads_get, _util.quadfile_t_dimquads_set) 331 index_scale_upper = property(_util.quadfile_t_index_scale_upper_get, _util.quadfile_t_index_scale_upper_set) 332 index_scale_lower = property(_util.quadfile_t_index_scale_lower_get, _util.quadfile_t_index_scale_lower_set) 333 indexid = property(_util.quadfile_t_indexid_get, _util.quadfile_t_indexid_set) 334 healpix = property(_util.quadfile_t_healpix_get, _util.quadfile_t_healpix_set) 335 hpnside = property(_util.quadfile_t_hpnside_get, _util.quadfile_t_hpnside_set) 336 fb = property(_util.quadfile_t_fb_get, _util.quadfile_t_fb_set) 337 quadarray = property(_util.quadfile_t_quadarray_get, _util.quadfile_t_quadarray_set) 338 339 def __init__(self): 340 _util.quadfile_t_swiginit(self, _util.new_quadfile_t()) 341 __swig_destroy__ = _util.delete_quadfile_t 342 343# Register quadfile_t in _util: 344_util.quadfile_t_swigregister(quadfile_t) 345 346 347def quadfile_open(fname): 348 return _util.quadfile_open(fname) 349 350def quadfile_open_fits(fits): 351 return _util.quadfile_open_fits(fits) 352 353def quadfile_get_filename(qf): 354 return _util.quadfile_get_filename(qf) 355 356def quadfile_open_for_writing(quadfname): 357 return _util.quadfile_open_for_writing(quadfname) 358 359def quadfile_open_in_memory(): 360 return _util.quadfile_open_in_memory() 361 362def quadfile_switch_to_reading(qf): 363 return _util.quadfile_switch_to_reading(qf) 364 365def quadfile_close(qf): 366 return _util.quadfile_close(qf) 367 368def quadfile_check(qf): 369 return _util.quadfile_check(qf) 370 371def quadfile_get_stars(qf, quadid): 372 return _util.quadfile_get_stars(qf, quadid) 373 374def quadfile_write_quad(qf): 375 return _util.quadfile_write_quad(qf) 376 377def quadfile_dimquads(qf): 378 return _util.quadfile_dimquads(qf) 379 380def quadfile_nquads(qf): 381 return _util.quadfile_nquads(qf) 382 383def quadfile_fix_header(qf): 384 return _util.quadfile_fix_header(qf) 385 386def quadfile_write_header(qf): 387 return _util.quadfile_write_header(qf) 388 389def quadfile_get_index_scale_upper_arcsec(qf): 390 return _util.quadfile_get_index_scale_upper_arcsec(qf) 391 392def quadfile_get_index_scale_lower_arcsec(qf): 393 return _util.quadfile_get_index_scale_lower_arcsec(qf) 394 395def quadfile_get_header(qf): 396 return _util.quadfile_get_header(qf) 397 398def quadfile_write_header_to(qf, fid): 399 return _util.quadfile_write_header_to(qf, fid) 400 401def quadfile_write_all_quads_to(qf, fid): 402 return _util.quadfile_write_all_quads_to(qf, fid) 403AN_FILETYPE_CODETREE = _util.AN_FILETYPE_CODETREE 404CODETREE_NAME = _util.CODETREE_NAME 405class codetree_t(object): 406 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 407 __repr__ = _swig_repr 408 tree = property(_util.codetree_t_tree_get, _util.codetree_t_tree_set) 409 header = property(_util.codetree_t_header_get, _util.codetree_t_header_set) 410 inverse_perm = property(_util.codetree_t_inverse_perm_get, _util.codetree_t_inverse_perm_set) 411 412 def __init__(self): 413 _util.codetree_t_swiginit(self, _util.new_codetree_t()) 414 __swig_destroy__ = _util.delete_codetree_t 415 416# Register codetree_t in _util: 417_util.codetree_t_swigregister(codetree_t) 418 419 420def codetree_open(fn): 421 return _util.codetree_open(fn) 422 423def codetree_open_fits(fits): 424 return _util.codetree_open_fits(fits) 425 426def codetree_get(s, codeid, code): 427 return _util.codetree_get(s, codeid, code) 428 429def codetree_N(s): 430 return _util.codetree_N(s) 431 432def codetree_nodes(s): 433 return _util.codetree_nodes(s) 434 435def codetree_D(s): 436 return _util.codetree_D(s) 437 438def codetree_get_permuted(s, index): 439 return _util.codetree_get_permuted(s, index) 440 441def codetree_header(s): 442 return _util.codetree_header(s) 443 444def codetree_close(s): 445 return _util.codetree_close(s) 446 447def codetree_new(): 448 return _util.codetree_new() 449 450def codetree_append_to(s, fid): 451 return _util.codetree_append_to(s, fid) 452 453def codetree_write_to_file(s, fn): 454 return _util.codetree_write_to_file(s, fn) 455 456def codetree_write_to_file_flipped(s, fn): 457 return _util.codetree_write_to_file_flipped(s, fn) 458AN_FILETYPE_STARTREE = _util.AN_FILETYPE_STARTREE 459AN_FILETYPE_TAGALONG = _util.AN_FILETYPE_TAGALONG 460STARTREE_NAME = _util.STARTREE_NAME 461class startree_t(object): 462 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 463 __repr__ = _swig_repr 464 tree = property(_util.startree_t_tree_get, _util.startree_t_tree_set) 465 header = property(_util.startree_t_header_get, _util.startree_t_header_set) 466 inverse_perm = property(_util.startree_t_inverse_perm_get, _util.startree_t_inverse_perm_set) 467 sweep = property(_util.startree_t_sweep_get, _util.startree_t_sweep_set) 468 writing = property(_util.startree_t_writing_get, _util.startree_t_writing_set) 469 tagalong = property(_util.startree_t_tagalong_get, _util.startree_t_tagalong_set) 470 471 def __init__(self): 472 _util.startree_t_swiginit(self, _util.new_startree_t()) 473 __swig_destroy__ = _util.delete_startree_t 474 475# Register startree_t in _util: 476_util.startree_t_swigregister(startree_t) 477 478 479def startree_open(fn): 480 return _util.startree_open(fn) 481 482def startree_open_fits(fits): 483 return _util.startree_open_fits(fits) 484 485def startree_search_for(s, xyzcenter, radius2, xyzresults, radecresults, starinds, nresults): 486 return _util.startree_search_for(s, xyzcenter, radius2, xyzresults, radecresults, starinds, nresults) 487 488def startree_search_for_radec(s, ra, dec, radius, xyzresults, radecresults, starinds, nresults): 489 return _util.startree_search_for_radec(s, ra, dec, radius, xyzresults, radecresults, starinds, nresults) 490 491def startree_search(s, xyzcenter, radius2, xyzresults, radecresults, nresults): 492 return _util.startree_search(s, xyzcenter, radius2, xyzresults, radecresults, nresults) 493 494def startree_get_data_column(s, colname, indices, N): 495 return _util.startree_get_data_column(s, colname, indices, N) 496 497def startree_get_data_column_int64(s, colname, indices, N): 498 return _util.startree_get_data_column_int64(s, colname, indices, N) 499 500def startree_get_data_column_array(s, colname, indices, N, arraysize): 501 return _util.startree_get_data_column_array(s, colname, indices, N, arraysize) 502 503def startree_free_data_column(s, d): 504 return _util.startree_free_data_column(s, d) 505 506def startree_has_tagalong(s): 507 return _util.startree_has_tagalong(s) 508 509def startree_get_tagalong(s): 510 return _util.startree_get_tagalong(s) 511 512def startree_get_tagalong_column_names(s, lst): 513 return _util.startree_get_tagalong_column_names(s, lst) 514 515def startree_get_tagalong_N_columns(s): 516 return _util.startree_get_tagalong_N_columns(s) 517 518def startree_get_tagalong_column_name(s, i): 519 return _util.startree_get_tagalong_column_name(s, i) 520 521def startree_get_tagalong_column_fits_type(s, i): 522 return _util.startree_get_tagalong_column_fits_type(s, i) 523 524def startree_get_tagalong_column_array_size(s, i): 525 return _util.startree_get_tagalong_column_array_size(s, i) 526 527def startree_get_cut_nside(s): 528 return _util.startree_get_cut_nside(s) 529 530def startree_get_cut_nsweeps(s): 531 return _util.startree_get_cut_nsweeps(s) 532 533def startree_get_cut_dedup(s): 534 return _util.startree_get_cut_dedup(s) 535 536def startree_get_cut_band(s): 537 return _util.startree_get_cut_band(s) 538 539def startree_get_cut_margin(s): 540 return _util.startree_get_cut_margin(s) 541 542def startree_get_jitter(s): 543 return _util.startree_get_jitter(s) 544 545def startree_set_jitter(s, jitter_arcsec): 546 return _util.startree_set_jitter(s, jitter_arcsec) 547 548def startree_get_sweep(s, ind): 549 return _util.startree_get_sweep(s, ind) 550 551def startree_N(s): 552 return _util.startree_N(s) 553 554def startree_nodes(s): 555 return _util.startree_nodes(s) 556 557def startree_D(s): 558 return _util.startree_D(s) 559 560def startree_header(s): 561 return _util.startree_header(s) 562 563def startree_get(s, starid, posn): 564 return _util.startree_get(s, starid, posn) 565 566def startree_get_radec(s, starid, ra, dec): 567 return _util.startree_get_radec(s, starid, ra, dec) 568 569def startree_close(s): 570 return _util.startree_close(s) 571 572def startree_compute_inverse_perm(s): 573 return _util.startree_compute_inverse_perm(s) 574 575def startree_check_inverse_perm(s): 576 return _util.startree_check_inverse_perm(s) 577 578def startree_new(): 579 return _util.startree_new() 580 581def startree_write_to_file(s, fn): 582 return _util.startree_write_to_file(s, fn) 583 584def startree_write_to_file_flipped(s, fn): 585 return _util.startree_write_to_file_flipped(s, fn) 586 587def startree_append_to(s, fid): 588 return _util.startree_append_to(s, fid) 589 590def code_alloc(DC): 591 return _util.code_alloc(DC) 592 593def code_free(code): 594 return _util.code_free(code) 595 596def code_get(code, i): 597 return _util.code_get(code, i) 598 599def codekd_addr(ind): 600 return _util.codekd_addr(ind) 601 602def starkd_addr(ind): 603 return _util.starkd_addr(ind) 604 605def quadfile_addr(ind): 606 return _util.quadfile_addr(ind) 607HP_MAX_INT_NSIDE = _util.HP_MAX_INT_NSIDE 608 609def healpix_xy_to_ring(hp, Nside): 610 return _util.healpix_xy_to_ring(hp, Nside) 611 612def healpix_ring_to_xy(ring_index, Nside): 613 return _util.healpix_ring_to_xy(ring_index, Nside) 614 615def healpix_xy_to_nested(hp, Nside): 616 return _util.healpix_xy_to_nested(hp, Nside) 617 618def healpix_nested_to_xy(nested_index, Nside): 619 return _util.healpix_nested_to_xy(nested_index, Nside) 620 621def healpix_decompose_ring(ring_index, Nside, p_ring_number, p_longitude_index): 622 return _util.healpix_decompose_ring(ring_index, Nside, p_ring_number, p_longitude_index) 623 624def healpix_compose_ring(ring, longind, Nside): 625 return _util.healpix_compose_ring(ring, longind, Nside) 626 627def healpix_decompose_xy(finehp, bighp, x, y, Nside): 628 return _util.healpix_decompose_xy(finehp, bighp, x, y, Nside) 629 630def healpix_decompose_xyl(finehp, bighp, x, y, Nside): 631 return _util.healpix_decompose_xyl(finehp, bighp, x, y, Nside) 632 633def healpix_compose_xy(bighp, x, y, Nside): 634 return _util.healpix_compose_xy(bighp, x, y, Nside) 635 636def healpix_compose_xyl(bighp, x, y, Nside): 637 return _util.healpix_compose_xyl(bighp, x, y, Nside) 638 639def healpix_convert_xy_nside(x, y, nside, outnside, outx, outy): 640 return _util.healpix_convert_xy_nside(x, y, nside, outnside, outx, outy) 641 642def healpix_convert_nside(hp, nside, outnside, outhp): 643 return _util.healpix_convert_nside(hp, nside, outnside, outhp) 644 645def radectohealpix(ra, dec, Nside): 646 return _util.radectohealpix(ra, dec, Nside) 647 648def radectohealpixf(ra, dec, Nside): 649 return _util.radectohealpixf(ra, dec, Nside) 650 651def radectohealpixl(ra, dec, Nside): 652 return _util.radectohealpixl(ra, dec, Nside) 653 654def radectohealpixlf(ra, dec, Nside): 655 return _util.radectohealpixlf(ra, dec, Nside) 656 657def radecdegtohealpix(ra, dec, Nside): 658 return _util.radecdegtohealpix(ra, dec, Nside) 659 660def radecdegtohealpixf(ra, dec, Nside): 661 return _util.radecdegtohealpixf(ra, dec, Nside) 662 663def radecdegtohealpixl(ra, dec, Nside): 664 return _util.radecdegtohealpixl(ra, dec, Nside) 665 666def radecdegtohealpixlf(ra, dec, Nside): 667 return _util.radecdegtohealpixlf(ra, dec, Nside) 668 669def xyztohealpix(x, y, z, Nside): 670 return _util.xyztohealpix(x, y, z, Nside) 671 672def xyztohealpixl(x, y, z, Nside): 673 return _util.xyztohealpixl(x, y, z, Nside) 674 675def xyztohealpixf(x, y, z, Nside): 676 return _util.xyztohealpixf(x, y, z, Nside) 677 678def xyztohealpixlf(x, y, z, Nside): 679 return _util.xyztohealpixlf(x, y, z, Nside) 680 681def xyzarrtohealpix(xyz, Nside): 682 return _util.xyzarrtohealpix(xyz, Nside) 683 684def xyzarrtohealpixl(xyz, Nside): 685 return _util.xyzarrtohealpixl(xyz, Nside) 686 687def xyzarrtohealpixf(xyz, Nside): 688 return _util.xyzarrtohealpixf(xyz, Nside) 689 690def healpix_to_xyz(hp, Nside, dx, dy): 691 return _util.healpix_to_xyz(hp, Nside, dx, dy) 692 693def healpix_to_xyzarr(hp, Nside, dx, dy, xyz): 694 return _util.healpix_to_xyzarr(hp, Nside, dx, dy, xyz) 695 696def healpix_to_radec(hp, Nside, dx, dy): 697 return _util.healpix_to_radec(hp, Nside, dx, dy) 698 699def healpix_to_radecdeg(hp, Nside, dx, dy): 700 return _util.healpix_to_radecdeg(hp, Nside, dx, dy) 701 702def healpixl_to_radecdeg(hp, Nside, dx, dy): 703 return _util.healpixl_to_radecdeg(hp, Nside, dx, dy) 704 705def healpix_to_radecarr(hp, Nside, dx, dy, radec): 706 return _util.healpix_to_radecarr(hp, Nside, dx, dy, radec) 707 708def healpix_to_radecdegarr(hp, Nside, dx, dy, radec): 709 return _util.healpix_to_radecdegarr(hp, Nside, dx, dy, radec) 710 711def healpix_side_length_arcmin(Nside): 712 return _util.healpix_side_length_arcmin(Nside) 713 714def healpix_nside_for_side_length_arcmin(arcmin): 715 return _util.healpix_nside_for_side_length_arcmin(arcmin) 716 717def healpix_get_neighbours(hp, Nside): 718 return _util.healpix_get_neighbours(hp, Nside) 719 720def healpix_get_neighboursl(pix, neighbour, Nside): 721 return _util.healpix_get_neighboursl(pix, neighbour, Nside) 722 723def healpix_get_neighbours_within_range(xyz, range, healpixes, Nside): 724 return _util.healpix_get_neighbours_within_range(xyz, range, healpixes, Nside) 725 726def healpix_get_neighbours_within_range_radec(ra, dec, radius, healpixes, Nside): 727 return _util.healpix_get_neighbours_within_range_radec(ra, dec, radius, healpixes, Nside) 728 729def healpix_distance_to_radec(hp, Nside, ra, dec, closestradec): 730 return _util.healpix_distance_to_radec(hp, Nside, ra, dec, closestradec) 731 732def healpix_distance_to_xyz(hp, Nside, xyz, closestxyz): 733 return _util.healpix_distance_to_xyz(hp, Nside, xyz, closestxyz) 734 735def healpix_within_range_of_radec(hp, Nside, ra, dec, radius): 736 return _util.healpix_within_range_of_radec(hp, Nside, ra, dec, radius) 737 738def healpix_within_range_of_xyz(hp, Nside, xyz, radius): 739 return _util.healpix_within_range_of_xyz(hp, Nside, xyz, radius) 740 741def healpix_radec_bounds(hp, nside): 742 return _util.healpix_radec_bounds(hp, nside) 743 744def healpix_rangesearch_xyz(xyz, radius, Nside): 745 return _util.healpix_rangesearch_xyz(xyz, radius, Nside) 746 747def healpix_rangesearch_xyz_approx(xyz, radius, Nside): 748 return _util.healpix_rangesearch_xyz_approx(xyz, radius, Nside) 749 750def healpix_rangesearch_radec_approx(ra, dec, radius, Nside): 751 return _util.healpix_rangesearch_radec_approx(ra, dec, radius, Nside) 752 753def healpix_rangesearch_radec(ra, dec, radius, Nside): 754 return _util.healpix_rangesearch_radec(ra, dec, radius, Nside) 755 756def healpix_region_search(seed, seeds, Nside, accepted, rejected, accept, token, depth): 757 return _util.healpix_region_search(seed, seeds, Nside, accepted, rejected, accept, token, depth) 758 759def anwcs_wcslib_to_string(wcs): 760 return _util.anwcs_wcslib_to_string(wcs) 761ANWCS_TYPE_WCSLIB = _util.ANWCS_TYPE_WCSLIB 762ANWCS_TYPE_SIP = _util.ANWCS_TYPE_SIP 763ANWCS_TYPE_WCSTOOLS = _util.ANWCS_TYPE_WCSTOOLS 764class anwcs_t(object): 765 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 766 __repr__ = _swig_repr 767 type = property(_util.anwcs_t_type_get, _util.anwcs_t_type_set) 768 data = property(_util.anwcs_t_data_get, _util.anwcs_t_data_set) 769 770 def __init__(self, fn, ext=0, slen=0): 771 _util.anwcs_t_swiginit(self, _util.new_anwcs_t(fn, ext, slen)) 772 __swig_destroy__ = _util.delete_anwcs_t 773 774 def pixel_scale(self): 775 return _util.anwcs_t_pixel_scale(self) 776 777 def get_center(self): 778 return _util.anwcs_t_get_center(self) 779 780 def get_radius(self): 781 return _util.anwcs_t_get_radius(self) 782 783 def is_inside(self, ra, dec): 784 return _util.anwcs_t_is_inside(self, ra, dec) 785 786 def get_width(self): 787 return _util.anwcs_t_get_width(self) 788 789 def get_height(self): 790 return _util.anwcs_t_get_height(self) 791 792 def set_width(self, W): 793 return _util.anwcs_t_set_width(self, W) 794 795 def set_height(self, H): 796 return _util.anwcs_t_set_height(self, H) 797 798 def pixelxy2radec(self, x, y): 799 return _util.anwcs_t_pixelxy2radec(self, x, y) 800 801 def radec2pixelxy(self, ra, dec): 802 return _util.anwcs_t_radec2pixelxy(self, ra, dec) 803 804 def write_to(self, filename): 805 return _util.anwcs_t_write_to(self, filename) 806 807# Register anwcs_t in _util: 808_util.anwcs_t_swigregister(anwcs_t) 809 810 811def anwcs_walk_outline(wcs, path, fill): 812 return _util.anwcs_walk_outline(wcs, path, fill) 813 814def anwcs_wcslib_from_string(str, len): 815 return _util.anwcs_wcslib_from_string(str, len) 816 817def anwcs_open(filename, ext): 818 return _util.anwcs_open(filename, ext) 819 820def anwcs_open_wcslib(filename, ext): 821 return _util.anwcs_open_wcslib(filename, ext) 822 823def anwcs_open_wcstools(filename, ext): 824 return _util.anwcs_open_wcstools(filename, ext) 825 826def anwcs_wcstools_from_string(str, len): 827 return _util.anwcs_wcstools_from_string(str, len) 828 829def anwcs_open_sip(filename, ext): 830 return _util.anwcs_open_sip(filename, ext) 831 832def anwcs_open_tan(filename, ext): 833 return _util.anwcs_open_tan(filename, ext) 834 835def anwcs_new_sip(sip): 836 return _util.anwcs_new_sip(sip) 837 838def anwcs_new_tan(tan): 839 return _util.anwcs_new_tan(tan) 840 841def anwcs_create_box(ra, dec, width, W, H): 842 return _util.anwcs_create_box(ra, dec, width, W, H) 843 844def anwcs_create_box_upsidedown(ra, dec, width, W, H): 845 return _util.anwcs_create_box_upsidedown(ra, dec, width, W, H) 846 847def anwcs_create_mercator(refra, refdec, zoomfactor, W, H, yflip): 848 return _util.anwcs_create_mercator(refra, refdec, zoomfactor, W, H, yflip) 849 850def anwcs_create_mercator_2(refra, refdec, crpix1, crpix2, zoomfactor, W, H, yflip): 851 return _util.anwcs_create_mercator_2(refra, refdec, crpix1, crpix2, zoomfactor, W, H, yflip) 852 853def anwcs_create_mollweide(refra, refdec, zoomfactor, W, H, yflip): 854 return _util.anwcs_create_mollweide(refra, refdec, zoomfactor, W, H, yflip) 855 856def anwcs_create_cea_wcs(refra, refdec, refx, refy, pixscale, W, H, yflip): 857 return _util.anwcs_create_cea_wcs(refra, refdec, refx, refy, pixscale, W, H, yflip) 858 859def anwcs_create_hammer_aitoff(refra, refdec, zoomfactor, W, H, yflip): 860 return _util.anwcs_create_hammer_aitoff(refra, refdec, zoomfactor, W, H, yflip) 861 862def anwcs_create_allsky_hammer_aitoff(refra, refdec, W, H): 863 return _util.anwcs_create_allsky_hammer_aitoff(refra, refdec, W, H) 864 865def anwcs_create_allsky_hammer_aitoff2(refra, refdec, W, H): 866 return _util.anwcs_create_allsky_hammer_aitoff2(refra, refdec, W, H) 867 868def anwcs_write(wcs, filename): 869 return _util.anwcs_write(wcs, filename) 870 871def anwcs_write_to(wcs, fid): 872 return _util.anwcs_write_to(wcs, fid) 873 874def anwcs_add_to_header(wcs, hdr): 875 return _util.anwcs_add_to_header(wcs, hdr) 876 877def anwcs_radec2pixelxy(wcs, ra, dec): 878 return _util.anwcs_radec2pixelxy(wcs, ra, dec) 879 880def anwcs_pixelxy2radec(wcs, px, py): 881 return _util.anwcs_pixelxy2radec(wcs, px, py) 882 883def anwcs_pixelxy2xyz(wcs, px, py): 884 return _util.anwcs_pixelxy2xyz(wcs, px, py) 885 886def anwcs_xyz2pixelxy(wcs, xyz, px, py): 887 return _util.anwcs_xyz2pixelxy(wcs, xyz, px, py) 888 889def anwcs_radec_is_inside_image(wcs, ra, dec): 890 return _util.anwcs_radec_is_inside_image(wcs, ra, dec) 891 892def anwcs_get_cd_matrix(wcs): 893 return _util.anwcs_get_cd_matrix(wcs) 894 895def anwcs_get_radec_bounds(wcs, stepsize): 896 return _util.anwcs_get_radec_bounds(wcs, stepsize) 897 898def anwcs_print(wcs, fid): 899 return _util.anwcs_print(wcs, fid) 900 901def anwcs_print_stdout(wcs): 902 return _util.anwcs_print_stdout(wcs) 903 904def anwcs_get_radec_center_and_radius(anwcs): 905 return _util.anwcs_get_radec_center_and_radius(anwcs) 906 907def anwcs_walk_image_boundary(wcs, stepsize, callback, token): 908 return _util.anwcs_walk_image_boundary(wcs, stepsize, callback, token) 909 910def anwcs_find_discontinuity(wcs, ra1, dec1, ra2, dec2, pra3, pdec3, pra4, pdec4): 911 return _util.anwcs_find_discontinuity(wcs, ra1, dec1, ra2, dec2, pra3, pdec3, pra4, pdec4) 912 913def anwcs_is_discontinuous(wcs, ra1, dec1, ra2, dec2): 914 return _util.anwcs_is_discontinuous(wcs, ra1, dec1, ra2, dec2) 915 916def anwcs_walk_discontinuity(wcs, ra1, dec1, ra2, dec2, ra3, dec3, ra4, dec4, stepsize, radecs): 917 return _util.anwcs_walk_discontinuity(wcs, ra1, dec1, ra2, dec2, ra3, dec3, ra4, dec4, stepsize, radecs) 918 919def anwcs_overlaps(wcs1, wcs2, stepsize): 920 return _util.anwcs_overlaps(wcs1, wcs2, stepsize) 921 922def anwcs_imagew(anwcs): 923 return _util.anwcs_imagew(anwcs) 924 925def anwcs_imageh(anwcs): 926 return _util.anwcs_imageh(anwcs) 927 928def anwcs_set_size(anwcs, W, H): 929 return _util.anwcs_set_size(anwcs, W, H) 930 931def anwcs_scale_wcs(anwcs, scale): 932 return _util.anwcs_scale_wcs(anwcs, scale) 933 934def anwcs_rotate_wcs(anwcs, angle): 935 return _util.anwcs_rotate_wcs(anwcs, angle) 936 937def anwcs_pixel_scale(anwcs): 938 return _util.anwcs_pixel_scale(anwcs) 939 940def anwcs_free(wcs): 941 return _util.anwcs_free(wcs) 942 943def anwcs_get_sip(wcs): 944 return _util.anwcs_get_sip(wcs) 945 946anwcs = anwcs_t 947anwcs.imagew = property(anwcs.get_width, anwcs.set_width, None, 'image width') 948anwcs.imageh = property(anwcs.get_height, anwcs.set_height, None, 'image height') 949anwcs.writeto = anwcs.write_to 950 951def anwcs_t_get_shape(self): 952 return int(self.get_height()), int(self.get_width()) 953anwcs_t.get_shape = anwcs_t_get_shape 954 955def anwcs_t_set_shape(self, S): 956 H,W = S 957 self.set_height(H) 958 self.set_width(W) 959anwcs_t.set_shape = anwcs_t_set_shape 960anwcs_t.shape = property(anwcs_t.get_shape, anwcs_t.set_shape, None, 'image shape') 961 962# same API as tan_t 963anwcs.radec_center = anwcs.get_center 964anwcs.radius = anwcs.get_radius 965 966def anwcs_from_string(s): 967 return anwcs_t(s, -1, len(s)) 968 969def anwcs_get_header_string(self): 970 s = anwcs_wcslib_to_string(self) 971 return (s + 972 'NAXIS = 2' + ' '*69 + 973 'NAXIS1 = % 20i' % self.imagew + ' '*50 + 974 'NAXIS2 = % 20i' % self.imageh + ' '*50 + 975 'END'+' '*77) 976anwcs.getHeaderString = anwcs_get_header_string 977 978def anwcs_radec_bounds(self, stepsize=1000): 979 r0,r1,d0,d1 = anwcs_get_radec_bounds(self, stepsize) 980 return r0,r1,d0,d1 981anwcs.radec_bounds = anwcs_radec_bounds 982 983def anwcs_get_cd(self): 984 return anwcs_get_cd_matrix(self) 985anwcs.get_cd = anwcs_get_cd 986 987 988DIM_STARS = _util.DIM_STARS 989DIM_XY = _util.DIM_XY 990DQMAX = _util.DQMAX 991DCMAX = _util.DCMAX 992 993def dimquad2dimcode(dimquad): 994 return _util.dimquad2dimcode(dimquad) 995ONE_OVER_SIXTY = _util.ONE_OVER_SIXTY 996RAD_PER_DEG = _util.RAD_PER_DEG 997RAD_PER_ARCMIN = _util.RAD_PER_ARCMIN 998RAD_PER_ARCSEC = _util.RAD_PER_ARCSEC 999DEG_PER_RAD = _util.DEG_PER_RAD 1000DEG_PER_ARCMIN = _util.DEG_PER_ARCMIN 1001DEG_PER_ARCSEC = _util.DEG_PER_ARCSEC 1002ARCMIN_PER_RAD = _util.ARCMIN_PER_RAD 1003ARCMIN_PER_DEG = _util.ARCMIN_PER_DEG 1004ARCMIN_PER_ARCSEC = _util.ARCMIN_PER_ARCSEC 1005ARCSEC_PER_RAD = _util.ARCSEC_PER_RAD 1006ARCSEC_PER_DEG = _util.ARCSEC_PER_DEG 1007ARCSEC_PER_ARCMIN = _util.ARCSEC_PER_ARCMIN 1008 1009def rad2deg(x): 1010 return _util.rad2deg(x) 1011 1012def rad2arcmin(x): 1013 return _util.rad2arcmin(x) 1014 1015def rad2arcsec(x): 1016 return _util.rad2arcsec(x) 1017 1018def deg2rad(x): 1019 return _util.deg2rad(x) 1020 1021def deg2arcmin(x): 1022 return _util.deg2arcmin(x) 1023 1024def deg2arcsec(x): 1025 return _util.deg2arcsec(x) 1026 1027def arcmin2rad(x): 1028 return _util.arcmin2rad(x) 1029 1030def arcmin2deg(x): 1031 return _util.arcmin2deg(x) 1032 1033def arcmin2arcsec(x): 1034 return _util.arcmin2arcsec(x) 1035 1036def arcsec2rad(x): 1037 return _util.arcsec2rad(x) 1038 1039def arcsec2deg(x): 1040 return _util.arcsec2deg(x) 1041 1042def arcsec2arcmin(x): 1043 return _util.arcsec2arcmin(x) 1044MJD_JD_OFFSET = _util.MJD_JD_OFFSET 1045 1046def mjdtojd(mjd): 1047 return _util.mjdtojd(mjd) 1048 1049def jdtomjd(jd): 1050 return _util.jdtomjd(jd) 1051 1052def xy2ra(x, y): 1053 return _util.xy2ra(x, y) 1054 1055def z2dec(z): 1056 return _util.z2dec(z) 1057 1058def atora(str): 1059 return _util.atora(str) 1060 1061def atodec(str): 1062 return _util.atodec(str) 1063 1064def mag2flux(mag): 1065 return _util.mag2flux(mag) 1066 1067def radecrange2xyzrange(ralow, declow, rahigh, dechigh, xyzlow, xyzhigh): 1068 return _util.radecrange2xyzrange(ralow, declow, rahigh, dechigh, xyzlow, xyzhigh) 1069 1070def radec2xyz(ra, dec, x, y, z): 1071 return _util.radec2xyz(ra, dec, x, y, z) 1072 1073def xyz2radec(x, y, z): 1074 return _util.xyz2radec(x, y, z) 1075 1076def xyzarr2radec(xyz): 1077 return _util.xyzarr2radec(xyz) 1078 1079def xyzarr2radecarr(xyz, radec): 1080 return _util.xyzarr2radecarr(xyz, radec) 1081 1082def radec2xyzarr(ra, dec): 1083 return _util.radec2xyzarr(ra, dec) 1084 1085def radec2xyzarrmany(xyz, n): 1086 return _util.radec2xyzarrmany(xyz, n) 1087 1088def radecdeg2xyz(ra, dec, x, y, z): 1089 return _util.radecdeg2xyz(ra, dec, x, y, z) 1090 1091def xyzarr2radecdeg(xyz): 1092 return _util.xyzarr2radecdeg(xyz) 1093 1094def xyzarr2radecdegarr(xyz, radec): 1095 return _util.xyzarr2radecdegarr(xyz, radec) 1096 1097def radecdeg2xyzarr(ra, dec): 1098 return _util.radecdeg2xyzarr(ra, dec) 1099 1100def radecdegarr2xyzarr(radec, xyz): 1101 return _util.radecdegarr2xyzarr(radec, xyz) 1102 1103def radecdeg2xyzarrmany(xyz, n): 1104 return _util.radecdeg2xyzarrmany(xyz, n) 1105 1106def radec_derivatives(ra, dec, dra, ddec): 1107 return _util.radec_derivatives(ra, dec, dra, ddec) 1108 1109def distsq_between_radecdeg(ra1, dec1, ra2, dec2): 1110 return _util.distsq_between_radecdeg(ra1, dec1, ra2, dec2) 1111 1112def arcsec_between_radecdeg(ra1, dec1, ra2, dec2): 1113 return _util.arcsec_between_radecdeg(ra1, dec1, ra2, dec2) 1114 1115def deg_between_radecdeg(ra1, dec1, ra2, dec2): 1116 return _util.deg_between_radecdeg(ra1, dec1, ra2, dec2) 1117 1118def ra2mercx(ra): 1119 return _util.ra2mercx(ra) 1120 1121def dec2mercy(dec): 1122 return _util.dec2mercy(dec) 1123 1124def ra2hms(ra, h, m, s): 1125 return _util.ra2hms(ra, h, m, s) 1126 1127def dec2dms(dec, sign, d, m, s): 1128 return _util.dec2dms(dec, sign, d, m, s) 1129 1130def hms2ra(h, m, s): 1131 return _util.hms2ra(h, m, s) 1132 1133def dms2dec(sgn, d, m, s): 1134 return _util.dms2dec(sgn, d, m, s) 1135 1136def ra2hmsstring(ra, str): 1137 return _util.ra2hmsstring(ra, str) 1138 1139def dec2dmsstring(dec, str): 1140 return _util.dec2dmsstring(dec, str) 1141 1142def project_hammer_aitoff_x(x, y, z, projx, projy): 1143 return _util.project_hammer_aitoff_x(x, y, z, projx, projy) 1144 1145def project_equal_area(x, y, z, projx, projy): 1146 return _util.project_equal_area(x, y, z, projx, projy) 1147 1148def distsq2arc(dist2): 1149 return _util.distsq2arc(dist2) 1150 1151def distsq2rad(dist2): 1152 return _util.distsq2rad(dist2) 1153 1154def distsq2deg(dist2): 1155 return _util.distsq2deg(dist2) 1156 1157def dist2rad(dist): 1158 return _util.dist2rad(dist) 1159 1160def distsq2arcsec(dist2): 1161 return _util.distsq2arcsec(dist2) 1162 1163def dist2arcsec(dist): 1164 return _util.dist2arcsec(dist) 1165 1166def rad2distsq(arcInRadians): 1167 return _util.rad2distsq(arcInRadians) 1168 1169def rad2dist(arcInRadians): 1170 return _util.rad2dist(arcInRadians) 1171 1172def arcsec2distsq(arcInArcSec): 1173 return _util.arcsec2distsq(arcInArcSec) 1174 1175def arcsec2dist(arcInArcSec): 1176 return _util.arcsec2dist(arcInArcSec) 1177 1178def deg2dist(arcInDegrees): 1179 return _util.deg2dist(arcInDegrees) 1180 1181def deg2distsq(d): 1182 return _util.deg2distsq(d) 1183 1184def arcmin2dist(arcmin): 1185 return _util.arcmin2dist(arcmin) 1186 1187def arcmin2distsq(arcmin): 1188 return _util.arcmin2distsq(arcmin) 1189 1190def dist2deg(dist): 1191 return _util.dist2deg(dist) 1192HELP_ERR = _util.HELP_ERR 1193OPT_ERR = _util.OPT_ERR 1194 1195def make_rand_star(star, ramin, ramax, decmin, decmax): 1196 return _util.make_rand_star(star, ramin, ramax, decmin, decmax) 1197 1198def star_coords(s, r, tangent, x, y): 1199 return _util.star_coords(s, r, tangent, x, y) 1200 1201def star_midpoint(mid, A, B): 1202 return _util.star_midpoint(mid, A, B) 1203 1204def qfits_header_debug_dump(arg1): 1205 return _util.qfits_header_debug_dump(arg1) 1206 1207def qfits_header_list(hdr, out): 1208 return _util.qfits_header_list(hdr, out) 1209 1210def qfits_header_new(): 1211 return _util.qfits_header_new() 1212 1213def qfits_header_default(): 1214 return _util.qfits_header_default() 1215 1216def qfits_header_n(arg1): 1217 return _util.qfits_header_n(arg1) 1218 1219def qfits_header_add(arg1, arg2, arg3, arg4, arg5): 1220 return _util.qfits_header_add(arg1, arg2, arg3, arg4, arg5) 1221 1222def qfits_header_add_after(arg1, arg2, arg3, arg4, arg5, arg6): 1223 return _util.qfits_header_add_after(arg1, arg2, arg3, arg4, arg5, arg6) 1224 1225def qfits_header_append(arg1, arg2, arg3, arg4, arg5): 1226 return _util.qfits_header_append(arg1, arg2, arg3, arg4, arg5) 1227 1228def qfits_header_del(arg1, arg2): 1229 return _util.qfits_header_del(arg1, arg2) 1230 1231def qfits_header_sort(arg1): 1232 return _util.qfits_header_sort(arg1) 1233 1234def qfits_header_copy(arg1): 1235 return _util.qfits_header_copy(arg1) 1236 1237def qfits_header_mod(arg1, arg2, arg3, arg4): 1238 return _util.qfits_header_mod(arg1, arg2, arg3, arg4) 1239 1240def qfits_header_destroy(arg1): 1241 return _util.qfits_header_destroy(arg1) 1242 1243def qfits_header_getstr(arg1, arg2): 1244 return _util.qfits_header_getstr(arg1, arg2) 1245 1246def qfits_header_getstr_pretty(hdr, key, pretty, default_val): 1247 return _util.qfits_header_getstr_pretty(hdr, key, pretty, default_val) 1248 1249def qfits_header_getitem(arg1, arg2, arg3, arg4, arg5, arg6): 1250 return _util.qfits_header_getitem(arg1, arg2, arg3, arg4, arg5, arg6) 1251 1252def qfits_header_setitem(arg1, arg2, key, val, comment, line): 1253 return _util.qfits_header_setitem(arg1, arg2, key, val, comment, line) 1254 1255def qfits_header_getcom(arg1, arg2): 1256 return _util.qfits_header_getcom(arg1, arg2) 1257 1258def qfits_header_getint(arg1, arg2, arg3): 1259 return _util.qfits_header_getint(arg1, arg2, arg3) 1260 1261def qfits_header_getdouble(arg1, arg2, arg3): 1262 return _util.qfits_header_getdouble(arg1, arg2, arg3) 1263 1264def qfits_header_getboolean(arg1, arg2, arg3): 1265 return _util.qfits_header_getboolean(arg1, arg2, arg3) 1266 1267def qfits_header_dump(arg1, arg2): 1268 return _util.qfits_header_dump(arg1, arg2) 1269 1270def qfits_header_findmatch(hdr, key): 1271 return _util.qfits_header_findmatch(hdr, key) 1272 1273def qfits_header_write_line(hdr, line, result): 1274 return _util.qfits_header_write_line(hdr, line, result) 1275 1276def qfits_header_read_hdr_string(arg1): 1277 return _util.qfits_header_read_hdr_string(arg1) 1278 1279def qfits_zeropad(arg1): 1280 return _util.qfits_zeropad(arg1) 1281 1282def qfits_is_fits(arg1): 1283 return _util.qfits_is_fits(arg1) 1284 1285def is_blank_line(s): 1286 return _util.is_blank_line(s) 1287 1288def fitsio_to_qfits_header(hdr): 1289 hdrstr = '' 1290 for rec in hdr.records(): 1291 cardstr = rec.get('card', None) 1292 if cardstr is None: 1293 cardstr = rec.get('card_string', None) 1294 if cardstr is None: 1295 cardstr = hdr._record2card(rec) 1296# pad 1297 cardstr = cardstr + ' '*(80 - len(cardstr)) 1298 hdrstr += cardstr 1299 hdrstr += 'END' + ' '*77 1300 qhdr = qfits_header_read_hdr_string(hdrstr) 1301 return qhdr 1302 1303 1304def wcs_pv2sip_header(hdr, xy, Nxy, stepsize, xlo, xhi, ylo, yhi, imageW, imageH, order, forcetan, doshift): 1305 return _util.wcs_pv2sip_header(hdr, xy, Nxy, stepsize, xlo, xhi, ylo, yhi, imageW, imageH, order, forcetan, doshift) 1306 1307def wcs_pv2sip(wcsinfn, ext, wcsoutfn, scamp_head_file, xy, Nxy, stepsize, xlo, xhi, ylo, yhi, imageW, imageH, order, forcetan, doshift): 1308 return _util.wcs_pv2sip(wcsinfn, ext, wcsoutfn, scamp_head_file, xy, Nxy, stepsize, xlo, xhi, ylo, yhi, imageW, imageH, order, forcetan, doshift) 1309 1310def wcs_pv2sip_hdr(hdr, order=5, xlo=0, xhi=0, ylo=0, yhi=0, 1311 stepsize=0, W=0, H=0): 1312 qhdr = fitsio_to_qfits_header(hdr) 1313 forcetan = False 1314 doshift = 1 1315 scamp = False 1316 1317 sip = wcs_pv2sip_header(qhdr, None, 0, stepsize, xlo, xhi, ylo, yhi, W, H, 1318 order, forcetan, doshift) 1319 return sip 1320 1321SIP_MAXORDER = _util.SIP_MAXORDER 1322class tan_t(object): 1323 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 1324 __repr__ = _swig_repr 1325 crval = property(_util.tan_t_crval_get, _util.tan_t_crval_set) 1326 crpix = property(_util.tan_t_crpix_get, _util.tan_t_crpix_set) 1327 cd = property(_util.tan_t_cd_get, _util.tan_t_cd_set) 1328 imagew = property(_util.tan_t_imagew_get, _util.tan_t_imagew_set) 1329 imageh = property(_util.tan_t_imageh_get, _util.tan_t_imageh_set) 1330 sin = property(_util.tan_t_sin_get, _util.tan_t_sin_set) 1331 1332 def __init__(self, *args): 1333 _util.tan_t_swiginit(self, _util.new_tan_t(*args)) 1334 __swig_destroy__ = _util.delete_tan_t 1335 1336 def set(self, crval1, crval2, crpix1, crpix2, cd11, cd12, cd21, cd22, imagew, imageh): 1337 return _util.tan_t_set(self, crval1, crval2, crpix1, crpix2, cd11, cd12, cd21, cd22, imagew, imageh) 1338 1339 def is_inside(self, ra, dec): 1340 return _util.tan_t_is_inside(self, ra, dec) 1341 1342 def scale(self, factor): 1343 return _util.tan_t_scale(self, factor) 1344 1345 def rotate(self, angle_deg): 1346 return _util.tan_t_rotate(self, angle_deg) 1347 1348 def get_width(self): 1349 return _util.tan_t_get_width(self) 1350 1351 def get_height(self): 1352 return _util.tan_t_get_height(self) 1353 1354 def set_width(self, x): 1355 return _util.tan_t_set_width(self, x) 1356 1357 def set_height(self, x): 1358 return _util.tan_t_set_height(self, x) 1359 1360 def pixel_scale(self): 1361 return _util.tan_t_pixel_scale(self) 1362 1363 def radec_center(self): 1364 return _util.tan_t_radec_center(self) 1365 1366 def radius(self): 1367 return _util.tan_t_radius(self) 1368 1369 def xyzcenter(self): 1370 return _util.tan_t_xyzcenter(self) 1371 1372 def pixelxy2xyz(self, x, y): 1373 return _util.tan_t_pixelxy2xyz(self, x, y) 1374 1375 def pixelxy2radec(self, x, y): 1376 return _util.tan_t_pixelxy2radec(self, x, y) 1377 1378 def radec2pixelxy(self, ra, dec): 1379 return _util.tan_t_radec2pixelxy(self, ra, dec) 1380 1381 def iwc2pixelxy(self, u, v): 1382 return _util.tan_t_iwc2pixelxy(self, u, v) 1383 1384 def pixelxy2iwc(self, x, y): 1385 return _util.tan_t_pixelxy2iwc(self, x, y) 1386 1387 def iwc2radec(self, u, v): 1388 return _util.tan_t_iwc2radec(self, u, v) 1389 1390 def radec2iwc(self, ra, dec): 1391 return _util.tan_t_radec2iwc(self, ra, dec) 1392 1393 def xyz2pixelxy(self, x, y, z): 1394 return _util.tan_t_xyz2pixelxy(self, x, y, z) 1395 1396 def write_to(self, filename): 1397 return _util.tan_t_write_to(self, filename) 1398 1399 def set_crval(self, ra, dec): 1400 return _util.tan_t_set_crval(self, ra, dec) 1401 1402 def set_crpix(self, x, y): 1403 return _util.tan_t_set_crpix(self, x, y) 1404 1405 def set_cd(self, cd11, cd12, cd21, cd22): 1406 return _util.tan_t_set_cd(self, cd11, cd12, cd21, cd22) 1407 1408 def set_imagesize(self, w, h): 1409 return _util.tan_t_set_imagesize(self, w, h) 1410 1411# Register tan_t in _util: 1412_util.tan_t_swigregister(tan_t) 1413 1414class sip_t(object): 1415 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 1416 __repr__ = _swig_repr 1417 wcstan = property(_util.sip_t_wcstan_get, _util.sip_t_wcstan_set) 1418 a_order = property(_util.sip_t_a_order_get, _util.sip_t_a_order_set) 1419 b_order = property(_util.sip_t_b_order_get, _util.sip_t_b_order_set) 1420 a = property(_util.sip_t_a_get, _util.sip_t_a_set) 1421 b = property(_util.sip_t_b_get, _util.sip_t_b_set) 1422 ap_order = property(_util.sip_t_ap_order_get, _util.sip_t_ap_order_set) 1423 bp_order = property(_util.sip_t_bp_order_get, _util.sip_t_bp_order_set) 1424 ap = property(_util.sip_t_ap_get, _util.sip_t_ap_set) 1425 bp = property(_util.sip_t_bp_get, _util.sip_t_bp_set) 1426 1427 def __init__(self, *args): 1428 _util.sip_t_swiginit(self, _util.new_sip_t(*args)) 1429 __swig_destroy__ = _util.delete_sip_t 1430 1431 def get_subimage(self, x0, y0, w, h): 1432 return _util.sip_t_get_subimage(self, x0, y0, w, h) 1433 1434 def scale(self, factor): 1435 return _util.sip_t_scale(self, factor) 1436 1437 def pixel_scale(self): 1438 return _util.sip_t_pixel_scale(self) 1439 1440 def radec_center(self): 1441 return _util.sip_t_radec_center(self) 1442 1443 def radius(self): 1444 return _util.sip_t_radius(self) 1445 1446 def write_to(self, filename): 1447 return _util.sip_t_write_to(self, filename) 1448 1449 def ensure_inverse_polynomials(self): 1450 return _util.sip_t_ensure_inverse_polynomials(self) 1451 1452 def pixelxy2xyz(self, x, y): 1453 return _util.sip_t_pixelxy2xyz(self, x, y) 1454 1455 def pixelxy2radec(self, x, y): 1456 return _util.sip_t_pixelxy2radec(self, x, y) 1457 1458 def radec2pixelxy(self, ra, dec): 1459 return _util.sip_t_radec2pixelxy(self, ra, dec) 1460 1461 def iwc2pixelxy(self, u, v): 1462 return _util.sip_t_iwc2pixelxy(self, u, v) 1463 1464 def pixelxy2iwc(self, x, y): 1465 return _util.sip_t_pixelxy2iwc(self, x, y) 1466 1467 def iwc2radec(self, u, v): 1468 return _util.sip_t_iwc2radec(self, u, v) 1469 1470 def radec2iwc(self, ra, dec): 1471 return _util.sip_t_radec2iwc(self, ra, dec) 1472 1473 def xyz2pixelxy(self, x, y, z): 1474 return _util.sip_t_xyz2pixelxy(self, x, y, z) 1475 1476 def is_inside(self, ra, dec): 1477 return _util.sip_t_is_inside(self, ra, dec) 1478 1479 def set_a_term(self, i, j, val): 1480 return _util.sip_t_set_a_term(self, i, j, val) 1481 1482 def set_b_term(self, i, j, val): 1483 return _util.sip_t_set_b_term(self, i, j, val) 1484 1485 def set_ap_term(self, i, j, val): 1486 return _util.sip_t_set_ap_term(self, i, j, val) 1487 1488 def set_bp_term(self, i, j, val): 1489 return _util.sip_t_set_bp_term(self, i, j, val) 1490 1491 def get_a_term(self, i, j): 1492 return _util.sip_t_get_a_term(self, i, j) 1493 1494 def get_b_term(self, i, j): 1495 return _util.sip_t_get_b_term(self, i, j) 1496 1497 def get_ap_term(self, i, j): 1498 return _util.sip_t_get_ap_term(self, i, j) 1499 1500 def get_bp_term(self, i, j): 1501 return _util.sip_t_get_bp_term(self, i, j) 1502 1503 def set_width(self, x): 1504 return _util.sip_t_set_width(self, x) 1505 1506 def set_height(self, x): 1507 return _util.sip_t_set_height(self, x) 1508 1509 def get_width(self): 1510 return _util.sip_t_get_width(self) 1511 1512 def get_height(self): 1513 return _util.sip_t_get_height(self) 1514 1515 def get_distortion(self, x, y): 1516 return _util.sip_t_get_distortion(self, x, y) 1517 1518 def get_undistortion(self, x, y): 1519 return _util.sip_t_get_undistortion(self, x, y) 1520 1521# Register sip_t in _util: 1522_util.sip_t_swigregister(sip_t) 1523 1524 1525def sip_create(): 1526 return _util.sip_create() 1527 1528def sip_free(sip): 1529 return _util.sip_free(sip) 1530 1531def sip_copy(dest, src): 1532 return _util.sip_copy(dest, src) 1533 1534def sip_wrap_tan(tan, sip): 1535 return _util.sip_wrap_tan(tan, sip) 1536 1537def sip_imagew(sip): 1538 return _util.sip_imagew(sip) 1539 1540def sip_imageh(sip): 1541 return _util.sip_imageh(sip) 1542 1543def sip_pixelxy2radec(sip, px, py, a, d): 1544 return _util.sip_pixelxy2radec(sip, px, py, a, d) 1545 1546def sip_pixelxy2xyzarr(sip, px, py, xyz): 1547 return _util.sip_pixelxy2xyzarr(sip, px, py, xyz) 1548 1549def sip_radec2pixelxy(sip, a, d, px, py): 1550 return _util.sip_radec2pixelxy(sip, a, d, px, py) 1551 1552def sip_radec2pixelxy_check(sip, ra, dec, px, py): 1553 return _util.sip_radec2pixelxy_check(sip, ra, dec, px, py) 1554 1555def sip_xyzarr2pixelxy(sip, xyz, px, py): 1556 return _util.sip_xyzarr2pixelxy(sip, xyz, px, py) 1557 1558def sip_xyz2pixelxy(sip, x, y, z, px, py): 1559 return _util.sip_xyz2pixelxy(sip, x, y, z, px, py) 1560 1561def sip_pixelxy2iwc(sip, px, py, iwcx, iwcy): 1562 return _util.sip_pixelxy2iwc(sip, px, py, iwcx, iwcy) 1563 1564def tan_det_cd(tan): 1565 return _util.tan_det_cd(tan) 1566 1567def sip_det_cd(sip): 1568 return _util.sip_det_cd(sip) 1569 1570def tan_pixel_scale(tn): 1571 return _util.tan_pixel_scale(tn) 1572 1573def sip_pixel_scale(sip): 1574 return _util.sip_pixel_scale(sip) 1575 1576def sip_calc_inv_distortion(sip, U, V, u, v): 1577 return _util.sip_calc_inv_distortion(sip, U, V, u, v) 1578 1579def sip_calc_distortion(sip, u, v, U, V): 1580 return _util.sip_calc_distortion(sip, u, v, U, V) 1581 1582def sip_pixel_distortion(sip, x, y): 1583 return _util.sip_pixel_distortion(sip, x, y) 1584 1585def sip_pixel_undistortion(sip, x, y): 1586 return _util.sip_pixel_undistortion(sip, x, y) 1587 1588def tan_pixelxy2xyzarr(tan, px, py, xyz): 1589 return _util.tan_pixelxy2xyzarr(tan, px, py, xyz) 1590 1591def tan_pixelxy2radec(wcs_tan, px, py): 1592 return _util.tan_pixelxy2radec(wcs_tan, px, py) 1593 1594def tan_pixelxy2radecarr(wcs_tan, px, py, radec): 1595 return _util.tan_pixelxy2radecarr(wcs_tan, px, py, radec) 1596 1597def tan_radec2pixelxy(wcs_tan, ra, dec, px, py): 1598 return _util.tan_radec2pixelxy(wcs_tan, ra, dec, px, py) 1599 1600def tan_xyzarr2pixelxy(wcs_tan, xyz, px, py): 1601 return _util.tan_xyzarr2pixelxy(wcs_tan, xyz, px, py) 1602 1603def tan_iwc2pixelxy(tan, iwcx, iwcy, px, py): 1604 return _util.tan_iwc2pixelxy(tan, iwcx, iwcy, px, py) 1605 1606def tan_iwc2xyzarr(tan, x, y, xyz): 1607 return _util.tan_iwc2xyzarr(tan, x, y, xyz) 1608 1609def tan_iwc2radec(tan, x, y): 1610 return _util.tan_iwc2radec(tan, x, y) 1611 1612def tan_pixelxy2iwc(tan, px, py, iwcx, iwcy): 1613 return _util.tan_pixelxy2iwc(tan, px, py, iwcx, iwcy) 1614 1615def tan_xyzarr2iwc(tan, xyz, iwcx, iwcy): 1616 return _util.tan_xyzarr2iwc(tan, xyz, iwcx, iwcy) 1617 1618def tan_radec2iwc(tan, ra, dec, iwcx, iwcy): 1619 return _util.tan_radec2iwc(tan, ra, dec, iwcx, iwcy) 1620 1621def sip_xyzarr2iwc(sip, xyz, iwcx, iwcy): 1622 return _util.sip_xyzarr2iwc(sip, xyz, iwcx, iwcy) 1623 1624def sip_radec2iwc(sip, ra, dec, iwcx, iwcy): 1625 return _util.sip_radec2iwc(sip, ra, dec, iwcx, iwcy) 1626 1627def sip_iwc2pixelxy(sip, iwcx, iwcy, px, py): 1628 return _util.sip_iwc2pixelxy(sip, iwcx, iwcy, px, py) 1629 1630def sip_iwc2radec(sip, x, y): 1631 return _util.sip_iwc2radec(sip, x, y) 1632 1633def sip_print(arg1): 1634 return _util.sip_print(arg1) 1635 1636def sip_print_to(arg1, fid): 1637 return _util.sip_print_to(arg1, fid) 1638 1639def tan_print(tan): 1640 return _util.tan_print(tan) 1641 1642def tan_print_to(tan, f): 1643 return _util.tan_print_to(tan, f) 1644 1645def sip_get_crval(sip): 1646 return _util.sip_get_crval(sip) 1647 1648def tan_get_orientation(tan): 1649 return _util.tan_get_orientation(tan) 1650 1651def sip_get_orientation(sip): 1652 return _util.sip_get_orientation(sip) 1653 1654def sip_get_image_size(hdr, pW, pH): 1655 return _util.sip_get_image_size(hdr, pW, pH) 1656 1657def sip_read_tan_or_sip_header_file_ext(fn, ext, dest, forcetan): 1658 return _util.sip_read_tan_or_sip_header_file_ext(fn, ext, dest, forcetan) 1659 1660def sip_create_header(sip): 1661 return _util.sip_create_header(sip) 1662 1663def tan_create_header(tan): 1664 return _util.tan_create_header(tan) 1665 1666def sip_add_to_header(hdr, sip): 1667 return _util.sip_add_to_header(hdr, sip) 1668 1669def tan_add_to_header(hdr, tan): 1670 return _util.tan_add_to_header(hdr, tan) 1671 1672def sip_read_header_file(fn, dest): 1673 return _util.sip_read_header_file(fn, dest) 1674 1675def sip_read_header_file_ext(fn, ext, dest): 1676 return _util.sip_read_header_file_ext(fn, ext, dest) 1677 1678def sip_read_header_file_ext_only(fn, ext, dest): 1679 return _util.sip_read_header_file_ext_only(fn, ext, dest) 1680 1681def tan_read_header_file(fn, dest): 1682 return _util.tan_read_header_file(fn, dest) 1683 1684def tan_read_header_file_ext(fn, ext, dest): 1685 return _util.tan_read_header_file_ext(fn, ext, dest) 1686 1687def tan_read_header_file_ext_only(fn, ext, dest): 1688 return _util.tan_read_header_file_ext_only(fn, ext, dest) 1689 1690def sip_read_header(hdr, dest): 1691 return _util.sip_read_header(hdr, dest) 1692 1693def tan_read_header(hdr, dest): 1694 return _util.tan_read_header(hdr, dest) 1695 1696def sip_from_string(str, len, dest): 1697 return _util.sip_from_string(str, len, dest) 1698 1699def tan_write_to(tan, fid): 1700 return _util.tan_write_to(tan, fid) 1701 1702def sip_write_to(sip, fid): 1703 return _util.sip_write_to(sip, fid) 1704 1705def sip_write_to_file(sip, fn): 1706 return _util.sip_write_to_file(sip, fn) 1707 1708def tan_write_to_file(tan, fn): 1709 return _util.tan_write_to_file(tan, fn) 1710 1711def wcs_pixel_center_for_size(size): 1712 return _util.wcs_pixel_center_for_size(size) 1713 1714def sip_ensure_inverse_polynomials(sip): 1715 return _util.sip_ensure_inverse_polynomials(sip) 1716 1717def sip_compute_inverse_polynomials(sip, NX, NY, xlo, xhi, ylo, yhi): 1718 return _util.sip_compute_inverse_polynomials(sip, NX, NY, xlo, xhi, ylo, yhi) 1719 1720def sip_filter_stars_in_field(sip, tan, xyz, radec, N, xy, inds, Ngood): 1721 return _util.sip_filter_stars_in_field(sip, tan, xyz, radec, N, xy, inds, Ngood) 1722 1723def sip_get_radec_bounds(wcs, stepsize): 1724 return _util.sip_get_radec_bounds(wcs, stepsize) 1725 1726def sip_walk_image_boundary(wcs, stepsize, callback, token): 1727 return _util.sip_walk_image_boundary(wcs, stepsize, callback, token) 1728 1729def sip_get_radec_center(wcs): 1730 return _util.sip_get_radec_center(wcs) 1731 1732def tan_get_radec_center(wcs): 1733 return _util.tan_get_radec_center(wcs) 1734 1735def sip_get_radius_deg(wcs): 1736 return _util.sip_get_radius_deg(wcs) 1737 1738def tan_get_radius_deg(wcs): 1739 return _util.tan_get_radius_deg(wcs) 1740 1741def sip_get_radec_center_hms(wcs, rah, ram, ras, decsign, decd, decm, decs): 1742 return _util.sip_get_radec_center_hms(wcs, rah, ram, ras, decsign, decd, decm, decs) 1743 1744def sip_pixel_is_inside_image(wcs, px, py): 1745 return _util.sip_pixel_is_inside_image(wcs, px, py) 1746 1747def sip_is_inside_image(wcs, ra, dec): 1748 return _util.sip_is_inside_image(wcs, ra, dec) 1749 1750def sip_get_radec_center_hms_string(wcs, rastr, decstr): 1751 return _util.sip_get_radec_center_hms_string(wcs, rastr, decstr) 1752 1753def sip_get_field_size(wcs, pw, ph, units): 1754 return _util.sip_get_field_size(wcs, pw, ph, units) 1755 1756def sip_shift(sipin, sipout, xlo, xhi, ylo, yhi): 1757 return _util.sip_shift(sipin, sipout, xlo, xhi, ylo, yhi) 1758 1759def tan_pixel_is_inside_image(wcs, px, py): 1760 return _util.tan_pixel_is_inside_image(wcs, px, py) 1761 1762def tan_is_inside_image(wcs, ra, dec): 1763 return _util.tan_is_inside_image(wcs, ra, dec) 1764 1765def tan_transform(tanin, tanout, xlo, xhi, ylo, yhi, scale): 1766 return _util.tan_transform(tanin, tanout, xlo, xhi, ylo, yhi, scale) 1767 1768def tan_scale(tanin, tanout, scale): 1769 return _util.tan_scale(tanin, tanout, scale) 1770 1771def sip_scale(tanin, tanout, scale): 1772 return _util.sip_scale(tanin, tanout, scale) 1773 1774def tan_rotate(tanin, tanout, rotate): 1775 return _util.tan_rotate(tanin, tanout, rotate) 1776 1777 1778def sip_t_tostring(self): 1779 tan = self.wcstan 1780 ct = 'SIN' if tan.sin else 'TAN' 1781 return (('SIP(%s): crpix (%.1f, %.1f), crval (%g, %g), cd (%g, %g, %g, %g), ' 1782 + 'image %g x %g; SIP orders A=%i, B=%i, AP=%i, BP=%i') % 1783 (ct, tan.crpix[0], tan.crpix[1], tan.crval[0], tan.crval[1], 1784 tan.cd[0], tan.cd[1], tan.cd[2], tan.cd[3], 1785 tan.imagew, tan.imageh, self.a_order, self.b_order, 1786 self.ap_order, self.bp_order)) 1787sip_t.__str__ = sip_t_tostring 1788 1789def sip_t_addtoheader(self, hdr): 1790 '''Adds this SIP WCS header to the given fitsio header''' 1791 self.wcstan.add_to_header(hdr) 1792 hdr.delete('CTYPE1') 1793 hdr.delete('CTYPE2') 1794 for k,v,c in [ 1795 ('CTYPE1', 'RA---TAN-SIP', 'TANgent plane+SIP'), 1796 ('CTYPE2', 'DEC--TAN-SIP', 'TANgent plane+SIP'), 1797 ('A_ORDER', self.a_order, 'Polynomial order, axis 1'), 1798 ('B_ORDER', self.b_order, 'Polynomial order, axis 2'), 1799 ('AP_ORDER', self.ap_order, 'Inv.polynomial order, axis 1'), 1800 ('BP_ORDER', self.bp_order, 'Inv.polynomial order, axis 2'), 1801 ]: 1802 hdr.add_record(dict(name=k, value=v, comment=c)) 1803 for i in range(self.a_order + 1): 1804 for j in range(self.a_order + 1): 1805#if i + j < 1: 1806# drop linear (CD) terms 1807 if i + j < 2: 1808 continue 1809 if i + j > self.a_order: 1810 continue 1811 hdr.add_record(dict(name='A_%i_%i' % (i,j), value=self.get_a_term(i, j), 1812 comment='SIP polynomial term')) 1813 for i in range(self.b_order + 1): 1814 for j in range(self.b_order + 1): 1815#if i + j < 1: 1816# drop linear (CD) terms 1817 if i + j < 2: 1818 continue 1819 if i + j > self.b_order: 1820 continue 1821 hdr.add_record(dict(name='B_%i_%i' % (i,j), value=self.get_b_term(i, j), 1822 comment='SIP polynomial term')) 1823 for i in range(self.ap_order + 1): 1824 for j in range(self.ap_order + 1): 1825 if i + j < 1: 1826 continue 1827 if i + j > self.ap_order: 1828 continue 1829 hdr.add_record(dict(name='AP_%i_%i' % (i,j), value=self.get_ap_term(i, j), 1830 comment='SIP polynomial term')) 1831 for i in range(self.bp_order + 1): 1832 for j in range(self.bp_order + 1): 1833 if i + j < 1: 1834 continue 1835 if i + j > self.bp_order: 1836 continue 1837 hdr.add_record(dict(name='BP_%i_%i' % (i,j), value=self.get_bp_term(i, j), 1838 comment='SIP polynomial term')) 1839sip_t.add_to_header = sip_t_addtoheader 1840 1841 1842# def sip_t_get_subimage(self, x0, y0, w, h): 1843# wcs2 = sip_t(self) 1844# cpx,cpy = wcs2.crpix 1845# wcs2.set_crpix((cpx - x0, cpy - y0)) 1846# wcs2.set_width(float(w)) 1847# wcs2.set_height(float(h)) 1848# return wcs2 1849# sip_t.get_subimage = sip_t_get_subimage 1850 1851def sip_t_get_shape(self): 1852 return (self.wcstan.imageh, self.wcstan.imagew) 1853sip_t.get_shape = sip_t_get_shape 1854 1855def sip_t_set_shape(self, S): 1856 H,W = S 1857 self.set_height(H) 1858 self.set_width(W) 1859sip_t.set_shape = sip_t_set_shape 1860 1861sip_t.imagew = property(sip_t.get_width, sip_t.set_width, None, 'image width') 1862sip_t.imageh = property(sip_t.get_height, sip_t.set_height, None, 'image height') 1863sip_t.shape = property(sip_t.get_shape, sip_t.set_shape, None, 'image shape') 1864 1865def sip_t_get_cd(self): 1866 cd = self.wcstan.cd 1867 return (cd[0], cd[1], cd[2], cd[3]) 1868def sip_t_set_cd(self, x): 1869 self.wcstan.cd = x 1870sip_t.get_cd = sip_t_get_cd 1871sip_t.set_cd = sip_t_set_cd 1872 1873def sip_t_get_crval(self): 1874 return self.wcstan.crval 1875def sip_t_set_crval(self, x): 1876 self.wcstan.crval = x 1877sip_t.get_crval = sip_t_get_crval 1878sip_t.set_crval = sip_t_set_crval 1879 1880def sip_t_get_crpix(self): 1881 return self.wcstan.crpix 1882def sip_t_set_crpix(self, x): 1883 self.wcstan.crpix = x 1884sip_t.get_crpix = sip_t_get_crpix 1885sip_t.set_crpix = sip_t_set_crpix 1886 1887sip_t.crval = property(sip_t_get_crval, sip_t_set_crval, None, 'CRVAL') 1888sip_t.crpix = property(sip_t_get_crpix, sip_t_set_crpix, None, 'CRPIX') 1889sip_t.cd = property(sip_t_get_cd , sip_t_set_cd, None, 'CD') 1890 1891 1892def sip_t_radec_bounds(self): 1893# W,H = self.wcstan.imagew, self.wcstan.imageh 1894# r,d = self.pixelxy2radec([1, W, W, 1], [1, 1, H, H]) 1895# return (r.min(), r.max(), d.min(), d.max()) 1896 W,H = self.imagew, self.imageh 1897 r,d = self.pixelxy2radec([1, W/2, W, W, W, W/2, 1, 1], [1, 1, 1, H/2, H, H, H, H/2]) 1898 rx = r.max() 1899 rn = r.min() 1900# ugh, RA wrap-around. We find the largest value < 180 (ie, near zero) and smallest value > 180 (ie, near 360) 1901# and report them with ralo > rahi so that this case can be identified 1902 if rx - rn > 180: 1903 rx = r[r < 180].max() 1904 rn = r[r > 180].min() 1905 return (rn, rx, d.min(), d.max()) 1906sip_t.radec_bounds = sip_t_radec_bounds 1907 1908#def sip_t_fromstring(s): 1909# sip = sip_from_string(s, len(s), 1910 1911_real_sip_t_init = sip_t.__init__ 1912def my_sip_t_init(self, *args, **kwargs): 1913# fitsio header: check for '.records()' function. 1914 if len(args) == 1 and hasattr(args[0], 'records'): 1915 try: 1916 hdr = args[0] 1917 qhdr = fitsio_to_qfits_header(hdr) 1918 args = [qhdr] 1919 except: 1920 pass 1921 1922 _real_sip_t_init(self, *args, **kwargs) 1923 if self.this is None: 1924 raise RuntimeError('Duck punch!') 1925sip_t.__init__ = my_sip_t_init 1926 1927 1928Sip = sip_t 1929 1930 1931def coadd_add_numpy(c, py_img, py_weight, fweight, wcs): 1932 return _util.coadd_add_numpy(c, py_img, py_weight, fweight, wcs) 1933 1934def coadd_get_snapshot_numpy(co, badpix): 1935 return _util.coadd_get_snapshot_numpy(co, badpix) 1936 1937def fit_sip_wcs_py(py_starxyz, py_fieldxy, py_weights, tanin, sip_order, inv_order): 1938 return _util.fit_sip_wcs_py(py_starxyz, py_fieldxy, py_weights, tanin, sip_order, inv_order) 1939 1940def broadcast_2to2ok(func, baton, in1, in2): 1941 return _util.broadcast_2to2ok(func, baton, in1, in2) 1942 1943def broadcast_2to2(func, baton, in1, in2): 1944 return _util.broadcast_2to2(func, baton, in1, in2) 1945 1946def broadcast_2to2i(func, baton, in1, in2): 1947 return _util.broadcast_2to2i(func, baton, in1, in2) 1948 1949def tan_rd2xy_wrapper(wcs, in1, in2): 1950 return _util.tan_rd2xy_wrapper(wcs, in1, in2) 1951 1952def sip_rd2xy_wrapper(wcs, in1, in2): 1953 return _util.sip_rd2xy_wrapper(wcs, in1, in2) 1954 1955def anwcs_rd2xy_wrapper(wcs, in1, in2): 1956 return _util.anwcs_rd2xy_wrapper(wcs, in1, in2) 1957 1958def tan_iwc2xy_wrapper(wcs, in1, in2): 1959 return _util.tan_iwc2xy_wrapper(wcs, in1, in2) 1960 1961def sip_iwc2xy_wrapper(wcs, in1, in2): 1962 return _util.sip_iwc2xy_wrapper(wcs, in1, in2) 1963 1964def tan_xy2iwc_wrapper(wcs, in1, in2): 1965 return _util.tan_xy2iwc_wrapper(wcs, in1, in2) 1966 1967def sip_xy2iwc_wrapper(wcs, in1, in2): 1968 return _util.sip_xy2iwc_wrapper(wcs, in1, in2) 1969 1970def tan_iwc2rd_wrapper(wcs, in1, in2): 1971 return _util.tan_iwc2rd_wrapper(wcs, in1, in2) 1972 1973def sip_iwc2rd_wrapper(wcs, in1, in2): 1974 return _util.sip_iwc2rd_wrapper(wcs, in1, in2) 1975 1976def tan_rd2iwc_wrapper(wcs, in1, in2): 1977 return _util.tan_rd2iwc_wrapper(wcs, in1, in2) 1978 1979def sip_rd2iwc_wrapper(wcs, in1, in2): 1980 return _util.sip_rd2iwc_wrapper(wcs, in1, in2) 1981 1982def tan_xy2rd_wrapper(wcs, in1, in2): 1983 return _util.tan_xy2rd_wrapper(wcs, in1, in2) 1984 1985def sip_xy2rd_wrapper(wcs, in1, in2): 1986 return _util.sip_xy2rd_wrapper(wcs, in1, in2) 1987 1988def anwcs_xy2rd_wrapper(wcs, in1, in2): 1989 return _util.anwcs_xy2rd_wrapper(wcs, in1, in2) 1990 1991def tan_wcs_resample(inwcs, outwcs, py_inimg, py_outimg, weighted, lorder): 1992 return _util.tan_wcs_resample(inwcs, outwcs, py_inimg, py_outimg, weighted, lorder) 1993 1994def tan_numpy_xyz2pixelxy(tan, npxyz, npx, npy): 1995 return _util.tan_numpy_xyz2pixelxy(tan, npxyz, npx, npy) 1996 1997def an_tally(py_counts, py_x, py_y): 1998 return _util.an_tally(py_counts, py_x, py_y) 1999 2000import numpy as np 2001 2002def tan_t_tostring(self): 2003 ct = 'SIN' if self.sin else 'TAN' 2004 return ('%s: crpix (%.1f, %.1f), crval (%g, %g), cd (%g, %g, %g, %g), image %g x %g' % 2005 (ct, self.crpix[0], self.crpix[1], self.crval[0], self.crval[1], 2006 self.cd[0], self.cd[1], self.cd[2], self.cd[3], 2007 self.imagew, self.imageh)) 2008tan_t.__str__ = tan_t_tostring 2009 2010def tan_t_addtoheader(self, hdr): 2011 '''Adds this TAN WCS header to the given fitsio header''' 2012 hdr.add_record(dict(name='CTYPE1', value='RA---TAN', comment='TANgent plane')) 2013 hdr.add_record(dict(name='CTYPE2', value='DEC--TAN', comment='TANgent plane')) 2014 hdr.add_record(dict(name='CRVAL1', value=self.crval[0], comment='Reference RA')) 2015 hdr.add_record(dict(name='CRVAL2', value=self.crval[1], comment='Reference Dec')) 2016 hdr.add_record(dict(name='CRPIX1', value=self.crpix[0], comment='Reference x')) 2017 hdr.add_record(dict(name='CRPIX2', value=self.crpix[1], comment='Reference y')) 2018 hdr.add_record(dict(name='CD1_1', value=self.cd[0], comment='CD matrix')) 2019 hdr.add_record(dict(name='CD1_2', value=self.cd[1], comment='CD matrix')) 2020 hdr.add_record(dict(name='CD2_1', value=self.cd[2], comment='CD matrix')) 2021 hdr.add_record(dict(name='CD2_2', value=self.cd[3], comment='CD matrix')) 2022 hdr.add_record(dict(name='IMAGEW', value=self.imagew, comment='Image width')) 2023 hdr.add_record(dict(name='IMAGEH', value=self.imageh, comment='Image height')) 2024tan_t.add_to_header = tan_t_addtoheader 2025 2026## picklable? 2027def tan_t_getstate(self): 2028 return (self.crpix[0], self.crpix[1], self.crval[0], self.crval[1], 2029 self.cd[0], self.cd[1], self.cd[2], self.cd[3], 2030 self.imagew, self.imageh, self.sin) 2031def tan_t_setstate(self, state): 2032#print 'setstate: self', self, 'state', state 2033#print 'state', state 2034 self.this = _util.new_tan_t() 2035#print 'self', repr(self) 2036 p0,p1,v0,v1,cd0,cd1,cd2,cd3,w,h,sin = state 2037 self.set_crpix(p0,p1) 2038 self.set_crval(v0,v1) 2039 self.set_cd(cd0,cd1,cd2,cd3) 2040 self.set_imagesize(w,h) 2041 self.sin = sin 2042#(self.crpix[0], self.crpix[1], self.crval[0], self.crval[1], 2043#self.cd[0], self.cd[1], self.cd[2], self.cd[3], 2044#self.imagew, self.imageh) = state 2045def tan_t_getnewargs(self): 2046 return () 2047tan_t.__getstate__ = tan_t_getstate 2048tan_t.__setstate__ = tan_t_setstate 2049tan_t.__getnewargs__ = tan_t_getnewargs 2050 2051def tan_t_getshape(self): 2052 return int(self.imageh), int(self.imagew) 2053 2054tan_t.shape = property(tan_t_getshape) 2055 2056def tan_t_get_cd(self): 2057 cd = self.cd 2058 return (cd[0], cd[1], cd[2], cd[3]) 2059tan_t.get_cd = tan_t_get_cd 2060 2061def tan_t_pixelxy2radec(self, x, y): 2062 return tan_xy2rd_wrapper(self.this, x, y) 2063tan_t.pixelxy2radec_single = tan_t.pixelxy2radec 2064tan_t.pixelxy2radec = tan_t_pixelxy2radec 2065 2066def tan_t_radec2pixelxy(self, r, d): 2067 return tan_rd2xy_wrapper(self.this, r, d) 2068tan_t.radec2pixelxy_single = tan_t.radec2pixelxy 2069tan_t.radec2pixelxy = tan_t_radec2pixelxy 2070 2071def tan_t_iwc2pixelxy(self, r, d): 2072 return tan_iwc2xy_wrapper(self.this, r, d) 2073tan_t.iwc2pixelxy_single = tan_t.iwc2pixelxy 2074tan_t.iwc2pixelxy = tan_t_iwc2pixelxy 2075 2076def tan_t_pixelxy2iwc(self, x,y): 2077 return tan_xy2iwc_wrapper(self.this, x,y) 2078tan_t.pixelxy2iwc_single = tan_t.pixelxy2iwc 2079tan_t.pixelxy2iwc = tan_t_pixelxy2iwc 2080 2081def tan_t_radec2iwc(self, r, d): 2082 return tan_rd2iwc_wrapper(self.this, r, d) 2083tan_t.radec2iwc_single = tan_t.radec2iwc 2084tan_t.radec2iwc = tan_t_radec2iwc 2085 2086def tan_t_iwc2radec(self, u, v): 2087 return tan_iwc2rd_wrapper(self.this, u, v) 2088tan_t.iwc2radec_single = tan_t.iwc2radec 2089tan_t.iwc2radec = tan_t_iwc2radec 2090 2091def sip_t_pixelxy2radec(self, x, y): 2092 return sip_xy2rd_wrapper(self.this, x, y) 2093sip_t.pixelxy2radec_single = sip_t.pixelxy2radec 2094sip_t.pixelxy2radec = sip_t_pixelxy2radec 2095 2096def sip_t_radec2pixelxy(self, r, d): 2097 return sip_rd2xy_wrapper(self.this, r, d) 2098sip_t.radec2pixelxy_single = sip_t.radec2pixelxy 2099sip_t.radec2pixelxy = sip_t_radec2pixelxy 2100 2101def sip_t_iwc2pixelxy(self, r, d): 2102 return sip_iwc2xy_wrapper(self.this, r, d) 2103sip_t.iwc2pixelxy_single = sip_t.iwc2pixelxy 2104sip_t.iwc2pixelxy = sip_t_iwc2pixelxy 2105 2106def sip_t_pixelxy2iwc(self, x,y): 2107 return sip_xy2iwc_wrapper(self.this, x,y) 2108sip_t.pixelxy2iwc_single = sip_t.pixelxy2iwc 2109sip_t.pixelxy2iwc = sip_t_pixelxy2iwc 2110 2111def sip_t_radec2iwc(self, r, d): 2112 return sip_rd2iwc_wrapper(self.this, r, d) 2113sip_t.radec2iwc_single = sip_t.radec2iwc 2114sip_t.radec2iwc = sip_t_radec2iwc 2115 2116def sip_t_iwc2radec(self, u, v): 2117 return sip_iwc2rd_wrapper(self.this, u, v) 2118sip_t.iwc2radec_single = sip_t.iwc2radec 2119sip_t.iwc2radec = sip_t_iwc2radec 2120 2121 2122def anwcs_t_pixelxy2radec(self, x, y): 2123 ok,r,d = anwcs_xy2rd_wrapper(self.this, x, y) 2124 return (ok == 0),r,d 2125anwcs_t.pixelxy2radec_single = anwcs_t.pixelxy2radec 2126anwcs_t.pixelxy2radec = anwcs_t_pixelxy2radec 2127 2128def anwcs_t_radec2pixelxy(self, r, d): 2129 ok,x,y = anwcs_rd2xy_wrapper(self.this, r, d) 2130 return (ok == 0),x,y 2131anwcs_t.radec2pixelxy_single = anwcs_t.radec2pixelxy 2132anwcs_t.radec2pixelxy = anwcs_t_radec2pixelxy 2133 2134def tan_t_radec_bounds(self): 2135 W,H = self.imagew, self.imageh 2136 r,d = self.pixelxy2radec([1, W/2, W, W, W, W/2, 1, 1], [1, 1, 1, H/2, H, H, H, H/2]) 2137 rx = r.max() 2138 rn = r.min() 2139# ugh, RA wrap-around. We find the largest value < 180 (ie, near zero) and smallest value > 180 (ie, near 360) 2140# and report them with ralo > rahi so that this case can be identified 2141 if rx - rn > 180: 2142 rx = r[r < 180].max() 2143 rn = r[r > 180].min() 2144 return (rn, rx, d.min(), d.max()) 2145tan_t.radec_bounds = tan_t_radec_bounds 2146 2147_real_tan_t_init = tan_t.__init__ 2148def my_tan_t_init(self, *args, **kwargs): 2149# fitsio header: check for '.records()' function. 2150 if len(args) == 1 and hasattr(args[0], 'records'): 2151 try: 2152 hdr = args[0] 2153 qhdr = fitsio_to_qfits_header(hdr) 2154 args = [qhdr] 2155 except: 2156 pass 2157 2158 _real_tan_t_init(self, *args, **kwargs) 2159 if self.this is None: 2160 raise RuntimeError('Duck punch!') 2161tan_t.__init__ = my_tan_t_init 2162 2163Tan = tan_t 2164 2165def tan_t_get_subimage(self, x0, y0, w, h): 2166 wcs2 = tan_t(self) 2167 cpx,cpy = wcs2.crpix 2168 wcs2.set_crpix(cpx - x0, cpy - y0) 2169 wcs2.set_width(float(w)) 2170 wcs2.set_height(float(h)) 2171 return wcs2 2172tan_t.get_subimage = tan_t_get_subimage 2173 2174# Deja Vu! 2175# def sip_t_get_subimage(self, xlo, xhi, ylo, yhi): 2176# sipout = sip_t(self) 2177# sip_shift(self.this, sipout.this, float(xlo), float(xhi), float(ylo), float(yhi)) 2178# return sipout 2179# sip_t.get_subimage = sip_t_get_subimage 2180 2181# picklable 2182def sip_t_getstate(self): 2183 t = (self.wcstan.__getstate__(), 2184 self.a_order, self.b_order, self.a, self.b, 2185 self.ap_order, self.bp_order, self.ap, self.bp) 2186 return t 2187 2188def sip_t_setstate(self, s): 2189 self.this = _util.new_sip_t() 2190 (t, self.a_order, self.b_order, self.a, self.b, 2191 self.ap_order, self.bp_order, self.ap, self.bp) = s 2192#self.wcstan.__setstate__(t) 2193# disturbingly, tan_t_setstate does not work because it resets self.this = ... 2194 p0,p1,v0,v1,cd0,cd1,cd2,cd3,w,h,sin = t 2195 self.wcstan.set_crpix(p0,p1) 2196 self.wcstan.set_crval(v0,v1) 2197 self.wcstan.set_cd(cd0,cd1,cd2,cd3) 2198 self.wcstan.set_imagesize(w,h) 2199 self.wcstan.sin = sin 2200 2201def sip_t_getnewargs(self): 2202 return () 2203 2204sip_t.__getstate__ = sip_t_getstate 2205sip_t.__setstate__ = sip_t_setstate 2206sip_t.__getnewargs__ = sip_t_getnewargs 2207 2208 2209 2210def fits_use_error_system(): 2211 return _util.fits_use_error_system() 2212 2213def fits_to_string(hdr, size): 2214 return _util.fits_to_string(hdr, size) 2215 2216def fits_write_float_image(img, nx, ny, fn): 2217 return _util.fits_write_float_image(img, nx, ny, fn) 2218 2219def fits_write_u8_image(img, nx, ny, fn): 2220 return _util.fits_write_u8_image(img, nx, ny, fn) 2221 2222def fits_write_i16_image(img, nx, ny, fn): 2223 return _util.fits_write_i16_image(img, nx, ny, fn) 2224 2225def fits_get_header_for_image(qd, W, addtoheader): 2226 return _util.fits_get_header_for_image(qd, W, addtoheader) 2227 2228def fits_get_header_for_image2(W, H, bitpix, addtoheader): 2229 return _util.fits_get_header_for_image2(W, H, bitpix, addtoheader) 2230 2231def fits_get_header_for_image3(W, H, bitpix, planes, addtoheader): 2232 return _util.fits_get_header_for_image3(W, H, bitpix, planes, addtoheader) 2233 2234def fits_write_header(hdr, filename): 2235 return _util.fits_write_header(hdr, filename) 2236 2237def fits_write_header_and_image(hdr, qd, W): 2238 return _util.fits_write_header_and_image(hdr, qd, W) 2239 2240def fits_get_double_val(table, column, rowdata): 2241 return _util.fits_get_double_val(table, column, rowdata) 2242 2243def fits_is_table_header(keyword): 2244 return _util.fits_is_table_header(keyword) 2245 2246def fits_is_primary_header(key): 2247 return _util.fits_is_primary_header(key) 2248 2249def fits_copy_non_table_headers(dest, src): 2250 return _util.fits_copy_non_table_headers(dest, src) 2251 2252def fits_get_dupstring(hdr, key): 2253 return _util.fits_get_dupstring(hdr, key) 2254 2255def fits_get_long_string(hdr, key): 2256 return _util.fits_get_long_string(hdr, key) 2257 2258def fits_header_addf(*args): 2259 return _util.fits_header_addf(*args) 2260 2261def fits_header_addf_longstring(*args): 2262 return _util.fits_header_addf_longstring(*args) 2263 2264def fits_header_add_longstring_boilerplate(hdr): 2265 return _util.fits_header_add_longstring_boilerplate(hdr) 2266 2267def fits_header_modf(*args): 2268 return _util.fits_header_modf(*args) 2269 2270def fits_header_add_int(hdr, key, val, comment): 2271 return _util.fits_header_add_int(hdr, key, val, comment) 2272 2273def fits_header_add_double(hdr, key, val, comment): 2274 return _util.fits_header_add_double(hdr, key, val, comment) 2275 2276def fits_header_set_double(hdr, key, val, comment): 2277 return _util.fits_header_set_double(hdr, key, val, comment) 2278 2279def fits_header_set_int(hdr, key, val, comment): 2280 return _util.fits_header_set_int(hdr, key, val, comment) 2281 2282def fits_header_mod_int(hdr, key, val, comment): 2283 return _util.fits_header_mod_int(hdr, key, val, comment) 2284 2285def fits_header_mod_double(hdr, key, val, comment): 2286 return _util.fits_header_mod_double(hdr, key, val, comment) 2287 2288def fits_update_value(hdr, key, newvalue): 2289 return _util.fits_update_value(hdr, key, newvalue) 2290 2291def fits_copy_table(tbl): 2292 return _util.fits_copy_table(tbl) 2293 2294def an_fits_copy_header(src, dest, key): 2295 return _util.an_fits_copy_header(src, dest, key) 2296 2297def fits_copy_all_headers(src, dest, targetkey): 2298 return _util.fits_copy_all_headers(src, dest, targetkey) 2299 2300def fits_append_all_headers(src, dest, targetkey): 2301 return _util.fits_append_all_headers(src, dest, targetkey) 2302 2303def fits_add_args(src, args, argc): 2304 return _util.fits_add_args(src, args, argc) 2305 2306def fits_add_long_comment(*args): 2307 return _util.fits_add_long_comment(*args) 2308 2309def fits_append_long_comment(*args): 2310 return _util.fits_append_long_comment(*args) 2311 2312def fits_add_long_history(*args): 2313 return _util.fits_add_long_history(*args) 2314 2315def fits_blocks_needed(size): 2316 return _util.fits_blocks_needed(size) 2317 2318def fits_bytes_needed(size): 2319 return _util.fits_bytes_needed(size) 2320 2321def fits_pad_file_with(fid, pad): 2322 return _util.fits_pad_file_with(fid, pad) 2323 2324def fits_pad_file(fid): 2325 return _util.fits_pad_file(fid) 2326 2327def fits_pad_file_name(filename): 2328 return _util.fits_pad_file_name(filename) 2329 2330def fits_fill_endian_string(str): 2331 return _util.fits_fill_endian_string(str) 2332 2333def fits_get_endian_string(): 2334 return _util.fits_get_endian_string() 2335 2336def fits_check_endian(header): 2337 return _util.fits_check_endian(header) 2338 2339def fits_check_uint_size(header): 2340 return _util.fits_check_uint_size(header) 2341 2342def fits_check_double_size(header): 2343 return _util.fits_check_double_size(header) 2344 2345def fits_add_endian(header): 2346 return _util.fits_add_endian(header) 2347 2348def fits_add_reverse_endian(header): 2349 return _util.fits_add_reverse_endian(header) 2350 2351def fits_mod_reverse_endian(header): 2352 return _util.fits_mod_reverse_endian(header) 2353 2354def fits_add_uint_size(header): 2355 return _util.fits_add_uint_size(header) 2356 2357def fits_add_double_size(header): 2358 return _util.fits_add_double_size(header) 2359 2360def fits_find_column(table, colname): 2361 return _util.fits_find_column(table, colname) 2362 2363def fits_find_table_column(fn, colname, start, size, extension): 2364 return _util.fits_find_table_column(fn, colname, start, size, extension) 2365 2366def fits_get_table_column(fn, colname, pcol): 2367 return _util.fits_get_table_column(fn, colname, pcol) 2368 2369def fits_add_column(table, column, type, ncopies, units, label): 2370 return _util.fits_add_column(table, column, type, ncopies, units, label) 2371 2372def fits_offset_of_column(table, colnum): 2373 return _util.fits_offset_of_column(table, colnum) 2374 2375def fits_write_data_A(fid, value): 2376 return _util.fits_write_data_A(fid, value) 2377 2378def fits_write_data_B(fid, value): 2379 return _util.fits_write_data_B(fid, value) 2380 2381def fits_write_data_D(fid, value, flip): 2382 return _util.fits_write_data_D(fid, value, flip) 2383 2384def fits_write_data_E(fid, value, flip): 2385 return _util.fits_write_data_E(fid, value, flip) 2386 2387def fits_write_data_I(fid, value, flip): 2388 return _util.fits_write_data_I(fid, value, flip) 2389 2390def fits_write_data_J(fid, value, flip): 2391 return _util.fits_write_data_J(fid, value, flip) 2392 2393def fits_write_data_K(fid, value, flip): 2394 return _util.fits_write_data_K(fid, value, flip) 2395 2396def fits_write_data_L(fid, value): 2397 return _util.fits_write_data_L(fid, value) 2398 2399def fits_write_data_X(fid, value): 2400 return _util.fits_write_data_X(fid, value) 2401 2402def fits_write_data(fid, pvalue, type, flip): 2403 return _util.fits_write_data(fid, pvalue, type, flip) 2404 2405def fits_write_data_array(fid, vvalue, type, N, flip): 2406 return _util.fits_write_data_array(fid, vvalue, type, N, flip) 2407 2408def collapsing_find_minlabel(label, equivs): 2409 return _util.collapsing_find_minlabel(label, equivs) 2410 2411def dfind2(image, nx, ny, objectimg, p_nobjects): 2412 return _util.dfind2(image, nx, ny, objectimg, p_nobjects) 2413 2414def dfind2_u8(image, nx, ny, objectimg, p_nobjects): 2415 return _util.dfind2_u8(image, nx, ny, objectimg, p_nobjects) 2416 2417def dselip(k, n, arr): 2418 return _util.dselip(k, n, arr) 2419 2420def dselip_cleanup(): 2421 return _util.dselip_cleanup() 2422 2423def dsmooth(image, nx, ny, sigma, smooth): 2424 return _util.dsmooth(image, nx, ny, sigma, smooth) 2425 2426def dsmooth2(image, nx, ny, sigma, smooth): 2427 return _util.dsmooth2(image, nx, ny, sigma, smooth) 2428 2429def dsmooth2_u8(image, nx, ny, sigma, smooth): 2430 return _util.dsmooth2_u8(image, nx, ny, sigma, smooth) 2431 2432def dsmooth2_i16(image, nx, ny, sigma, smooth): 2433 return _util.dsmooth2_i16(image, nx, ny, sigma, smooth) 2434 2435def dobjects(image, nx, ny, limit, dpsf, objects): 2436 return _util.dobjects(image, nx, ny, limit, dpsf, objects) 2437 2438def dmask(image, nx, ny, limit, dpsf, mask): 2439 return _util.dmask(image, nx, ny, limit, dpsf, mask) 2440 2441def dpeaks(image, nx, ny, npeaks, xcen, ycen, sigma, dlim, saddle, maxnpeaks, smooth, checkpeaks, minpeak): 2442 return _util.dpeaks(image, nx, ny, npeaks, xcen, ycen, sigma, dlim, saddle, maxnpeaks, smooth, checkpeaks, minpeak) 2443 2444def dcen3x3(image): 2445 return _util.dcen3x3(image) 2446 2447def dsigma(image, nx, ny, sp, gridsize, sigma): 2448 return _util.dsigma(image, nx, ny, sp, gridsize, sigma) 2449 2450def dsigma_u8(image, nx, ny, sp, gridsize, sigma): 2451 return _util.dsigma_u8(image, nx, ny, sp, gridsize, sigma) 2452 2453def dmedsmooth(image, masked, nx, ny, halfbox, smooth): 2454 return _util.dmedsmooth(image, masked, nx, ny, halfbox, smooth) 2455 2456def dallpeaks(image, nx, ny, objects, npeaks, dpsf, sigma, dlim, saddle, maxper, maxnpeaks, minpeak, maxsize): 2457 return _util.dallpeaks(image, nx, ny, objects, npeaks, dpsf, sigma, dlim, saddle, maxper, maxnpeaks, minpeak, maxsize) 2458 2459def dallpeaks_u8(image, nx, ny, objects, npeaks, dpsf, sigma, dlim, saddle, maxper, maxnpeaks, minpeak, maxsize): 2460 return _util.dallpeaks_u8(image, nx, ny, objects, npeaks, dpsf, sigma, dlim, saddle, maxper, maxnpeaks, minpeak, maxsize) 2461 2462def dallpeaks_i16(image, nx, ny, objects, npeaks, dpsf, sigma, dlim, saddle, maxper, maxnpeaks, minpeak, maxsize): 2463 return _util.dallpeaks_i16(image, nx, ny, objects, npeaks, dpsf, sigma, dlim, saddle, maxper, maxnpeaks, minpeak, maxsize) 2464 2465def dcen3x3b(i0, i1, i2, i3, i4, i5, i6, i7, i8): 2466 return _util.dcen3x3b(i0, i1, i2, i3, i4, i5, i6, i7, i8) 2467 2468 2469