LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Static Public Attributes | List of all members
lsst.afw.geom._hpxUtils._ZOrderCurve2DInt Class Reference
Inheritance diagram for lsst.afw.geom._hpxUtils._ZOrderCurve2DInt:

Public Member Functions

def __init__ (self)
 
def xy2hash (self, x, y)
 
def ij2hash (self, i, j)
 
def i02hash (self, i)
 
def hash2ij (self, h)
 
def hash2i0 (self, _hash)
 
def ij2i (self, ij)
 
def ij2j (self, ij)
 

Static Public Attributes

 LUPT_TO_HASH
 
 LUPT_TO_IJ_INT
 

Detailed Description

Z-Order 2D curve for 32-bit integer values.

Code is ported from AladinSrc.jar version 11.024,
ZOrderCurve2DImpls.java.
AladinSrc.jar is licensed with GPLv3, see
http://aladin.u-strasbg.fr/COPYING

From the original documentation:
"Z-Order Curve (ZOC) implementation in which the vertical coordinate
carry the most significant bit (VMSB). This implementation is based
on a lookup table (LOOKUP). We assume that each discritized
coordinates is coded on maximum 32 bits (INT)."

Definition at line 217 of file _hpxUtils.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.__init__ (   self)

Definition at line 303 of file _hpxUtils.py.

303  def __init__(self):
304  pass
305 

Member Function Documentation

◆ hash2i0()

def lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.hash2i0 (   self,
  _hash 
)
Special case of hash2ij in which the discretized coordinate along
the vertical axis is zero.

Parameters
----------
_hash : `int`
    Space-filling hash value.

Returns
-------
ij : `np.int64`
    Single value from which 2d coordinates can be extracted.

Definition at line 412 of file _hpxUtils.py.

412  def hash2i0(self, _hash):
413  """
414  Special case of hash2ij in which the discretized coordinate along
415  the vertical axis is zero.
416 
417  Parameters
418  ----------
419  _hash : `int`
420  Space-filling hash value.
421 
422  Returns
423  -------
424  ij : `np.int64`
425  Single value from which 2d coordinates can be extracted.
426  """
427  assert((0xFFFFFFFF33333333 & np.int64(_hash)) == 0)
428  return self.hash2ij(_hash)
429 

◆ hash2ij()

def lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.hash2ij (   self,
  h 
)
Transforms the given space-filling hash value into a single value
from which the 2d coordinates can be extracted using ij2i and ij2j.

Parameters
----------
h : `int`
    Space-filling hash value

Returns
-------
ij : `np.int64`
    Single value from which 2d coordinates can be extracted.

Definition at line 371 of file _hpxUtils.py.

371  def hash2ij(self, h):
372  """
373  Transforms the given space-filling hash value into a single value
374  from which the 2d coordinates can be extracted using ij2i and ij2j.
375 
376  Parameters
377  ----------
378  h : `int`
379  Space-filling hash value
380 
381  Returns
382  -------
383  ij : `np.int64`
384  Single value from which 2d coordinates can be extracted.
385  """
386  val1 = self.LUPT_TO_IJ_INT[
387  np.int32((np.uint64(h)
388  & np.uint64(0xFF00000000000000)) >> np.uint64(56))] << np.int64(28)
389  val2 = self.LUPT_TO_IJ_INT[
390  np.int32((np.uint64(h)
391  & np.uint64(0x00FF000000000000)) >> np.uint64(48))] << np.int64(24)
392  val3 = self.LUPT_TO_IJ_INT[
393  np.int32((np.uint64(h)
394  & np.uint64(0x0000FF0000000000)) >> np.uint64(40))] << np.int64(20)
395  val4 = self.LUPT_TO_IJ_INT[
396  np.int32((np.uint64(h)
397  & np.uint64(0x000000FF00000000)) >> np.uint64(32))] << np.int64(16)
398  val5 = self.LUPT_TO_IJ_INT[
399  np.int32((np.uint64(h)
400  & np.uint64(0x00000000FF000000)) >> np.uint64(24))] << np.int64(12)
401  val6 = self.LUPT_TO_IJ_INT[
402  np.int32((np.uint64(h)
403  & np.uint64(0x0000000000FF0000)) >> np.uint64(16))] << np.int64(8)
404  val7 = self.LUPT_TO_IJ_INT[
405  np.int32((np.uint64(h)
406  & np.uint64(0x000000000000FF00)) >> np.uint64(8))] << np.int64(4)
407  val8 = self.LUPT_TO_IJ_INT[
408  np.int32((np.uint64(h)
409  & np.uint64(0x00000000000000FF)))]
410  return val1 | val2 | val3 | val4 | val5 | val6 | val7 | val8
411 

◆ i02hash()

def lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.i02hash (   self,
  i 
)
Special case of ij2hash in which the discretized coordinate along
the vertical axis equals zero.

Parameters
----------
i : `int`
    i discretized coordinate along the horizontal axis.
    Must fit within the 32-bit integer range.

Returns
-------
hash : `numpy.int64`
    The space-filling hash value associated with the
    given coordinate.

Definition at line 348 of file _hpxUtils.py.

348  def i02hash(self, i):
349  """
350  Special case of ij2hash in which the discretized coordinate along
351  the vertical axis equals zero.
352 
353  Parameters
354  ----------
355  i : `int`
356  i discretized coordinate along the horizontal axis.
357  Must fit within the 32-bit integer range.
358 
359  Returns
360  -------
361  hash : `numpy.int64`
362  The space-filling hash value associated with the
363  given coordinate.
364  """
365  val1 = np.int64(self.LUPT_TO_HASH[np.uint32(i) >> np.uint32(24)] << np.int64(48))
366  val2 = np.int64(self.LUPT_TO_HASH[(np.uint32(i) & 0x00FF0000) >> np.uint32(16)] << np.uint64(32))
367  val3 = np.int64(self.LUPT_TO_HASH[(np.uint32(i) & 0x0000FF00) >> np.uint32(8)] << np.uint64(16))
368  val4 = np.int64(self.LUPT_TO_HASH[np.uint32(i) & 0x000000FF])
369  return val1 | val2 | val3 | val4
370 

◆ ij2hash()

def lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.ij2hash (   self,
  i,
  j 
)
Compute the hash value from discretized i, j.

Parameters
----------
i : `int`
    i discretized coordinate along the horizontal axis.
    Must fit within the 32-bit integer range.
j : `int`
    j discretized coordinate along the vertical axis.
    Must fit within the 32-bit integer range.

Returns
-------
hash : `numpy.int64`
    The space-filling hash value associated with the
    given coordinates.

Definition at line 327 of file _hpxUtils.py.

327  def ij2hash(self, i, j):
328  """
329  Compute the hash value from discretized i, j.
330 
331  Parameters
332  ----------
333  i : `int`
334  i discretized coordinate along the horizontal axis.
335  Must fit within the 32-bit integer range.
336  j : `int`
337  j discretized coordinate along the vertical axis.
338  Must fit within the 32-bit integer range.
339 
340  Returns
341  -------
342  hash : `numpy.int64`
343  The space-filling hash value associated with the
344  given coordinates.
345  """
346  return (self.i02hash(np.int32(j)) << 1) | self.i02hash(np.int32(i))
347 

◆ ij2i()

def lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.ij2i (   self,
  ij 
)
Extract the discretized horizontal coordinate from hash2ij.

Parameters
----------
ij : `int`
    The ij result of hash2ij.

Returns
-------
i : `np.int32`
    Discretized horizontal coordinate stored in ij.

Definition at line 430 of file _hpxUtils.py.

430  def ij2i(self, ij):
431  """
432  Extract the discretized horizontal coordinate from hash2ij.
433 
434  Parameters
435  ----------
436  ij : `int`
437  The ij result of hash2ij.
438 
439  Returns
440  -------
441  i : `np.int32`
442  Discretized horizontal coordinate stored in ij.
443  """
444  return np.int32(ij)
445 

◆ ij2j()

def lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.ij2j (   self,
  ij 
)
Extract the discretized vertical coordinate from hash2ij.

Parameters
----------
ij : `int`
    The ij result of hash2ij.

Returns
-------
j : `np.int32`
    Discretized vertical coordinate stored in ij.

Definition at line 446 of file _hpxUtils.py.

446  def ij2j(self, ij):
447  """
448  Extract the discretized vertical coordinate from hash2ij.
449 
450  Parameters
451  ----------
452  ij : `int`
453  The ij result of hash2ij.
454 
455  Returns
456  -------
457  j : `np.int32`
458  Discretized vertical coordinate stored in ij.
459  """
460  return np.int32(np.uint64(ij) >> np.uint64(32))

◆ xy2hash()

def lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.xy2hash (   self,
  x,
  y 
)
Compute the hash value from x/y.

Parameters
----------
x : `float`
    x coordinate along the horizontal axis.
    Must fit within the 32-bit integer range.
y : `float`
    y coordinate along the vertical axis.
    Must fit within the 32-bit integer range.

Returns
-------
hash : `numpy.int64`
    The space-filling hash value associated with the
    given coordinates.

Definition at line 306 of file _hpxUtils.py.

306  def xy2hash(self, x, y):
307  """
308  Compute the hash value from x/y.
309 
310  Parameters
311  ----------
312  x : `float`
313  x coordinate along the horizontal axis.
314  Must fit within the 32-bit integer range.
315  y : `float`
316  y coordinate along the vertical axis.
317  Must fit within the 32-bit integer range.
318 
319  Returns
320  -------
321  hash : `numpy.int64`
322  The space-filling hash value associated with the
323  given coordinates.
324  """
325  return self.ij2hash(np.int32(x), np.int32(y))
326 

Member Data Documentation

◆ LUPT_TO_HASH

lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.LUPT_TO_HASH
static
Initial value:
= np.array([
0x0000, 0x0001, 0x0004, 0x0005, 0x0010, 0x0011, 0x0014, 0x0015, 0x0040, 0x0041, 0x0044,
0x0045, 0x0050, 0x0051, 0x0054, 0x0055, 0x0100, 0x0101, 0x0104, 0x0105, 0x0110, 0x0111,
0x0114, 0x0115, 0x0140, 0x0141, 0x0144, 0x0145, 0x0150, 0x0151, 0x0154, 0x0155, 0x0400,
0x0401, 0x0404, 0x0405, 0x0410, 0x0411, 0x0414, 0x0415, 0x0440, 0x0441, 0x0444, 0x0445,
0x0450, 0x0451, 0x0454, 0x0455, 0x0500, 0x0501, 0x0504, 0x0505, 0x0510, 0x0511, 0x0514,
0x0515, 0x0540, 0x0541, 0x0544, 0x0545, 0x0550, 0x0551, 0x0554, 0x0555, 0x1000, 0x1001,
0x1004, 0x1005, 0x1010, 0x1011, 0x1014, 0x1015, 0x1040, 0x1041, 0x1044, 0x1045, 0x1050,
0x1051, 0x1054, 0x1055, 0x1100, 0x1101, 0x1104, 0x1105, 0x1110, 0x1111, 0x1114, 0x1115,
0x1140, 0x1141, 0x1144, 0x1145, 0x1150, 0x1151, 0x1154, 0x1155, 0x1400, 0x1401, 0x1404,
0x1405, 0x1410, 0x1411, 0x1414, 0x1415, 0x1440, 0x1441, 0x1444, 0x1445, 0x1450, 0x1451,
0x1454, 0x1455, 0x1500, 0x1501, 0x1504, 0x1505, 0x1510, 0x1511, 0x1514, 0x1515, 0x1540,
0x1541, 0x1544, 0x1545, 0x1550, 0x1551, 0x1554, 0x1555, 0x4000, 0x4001, 0x4004, 0x4005,
0x4010, 0x4011, 0x4014, 0x4015, 0x4040, 0x4041, 0x4044, 0x4045, 0x4050, 0x4051, 0x4054,
0x4055, 0x4100, 0x4101, 0x4104, 0x4105, 0x4110, 0x4111, 0x4114, 0x4115, 0x4140, 0x4141,
0x4144, 0x4145, 0x4150, 0x4151, 0x4154, 0x4155, 0x4400, 0x4401, 0x4404, 0x4405, 0x4410,
0x4411, 0x4414, 0x4415, 0x4440, 0x4441, 0x4444, 0x4445, 0x4450, 0x4451, 0x4454, 0x4455,
0x4500, 0x4501, 0x4504, 0x4505, 0x4510, 0x4511, 0x4514, 0x4515, 0x4540, 0x4541, 0x4544,
0x4545, 0x4550, 0x4551, 0x4554, 0x4555, 0x5000, 0x5001, 0x5004, 0x5005, 0x5010, 0x5011,
0x5014, 0x5015, 0x5040, 0x5041, 0x5044, 0x5045, 0x5050, 0x5051, 0x5054, 0x5055, 0x5100,
0x5101, 0x5104, 0x5105, 0x5110, 0x5111, 0x5114, 0x5115, 0x5140, 0x5141, 0x5144, 0x5145,
0x5150, 0x5151, 0x5154, 0x5155, 0x5400, 0x5401, 0x5404, 0x5405, 0x5410, 0x5411, 0x5414,
0x5415, 0x5440, 0x5441, 0x5444, 0x5445, 0x5450, 0x5451, 0x5454, 0x5455, 0x5500, 0x5501,
0x5504, 0x5505, 0x5510, 0x5511, 0x5514, 0x5515, 0x5540, 0x5541, 0x5544, 0x5545, 0x5550,
0x5551, 0x5554, 0x5555], dtype=np.int16)

Definition at line 232 of file _hpxUtils.py.

◆ LUPT_TO_IJ_INT

lsst.afw.geom._hpxUtils._ZOrderCurve2DInt.LUPT_TO_IJ_INT
static

Definition at line 258 of file _hpxUtils.py.


The documentation for this class was generated from the following file: