Index

Functions

skysearcher.skysearch_lib.time() → floating point number

Return the current time in seconds since the Epoch. Fractions of a second may be present if the system clock provides them.

skysearcher.skysearch_lib.clear_tables(_target_dir)[source]

Clear all MPI temp tables from MPI_TABLE_DIR before creating new ones.

Parameters:

_target_dir (str, optional) – PATH to target directory.

Raises:

Example

>>> from skysearcher.skysearch_lib import *
>>> import os
>>> os.listdir(MPI_TABLE_DIR)
['17.hdf5',
 '2.hdf5',
 '11.hdf5',
 ...,
 '0.hdf5',
 '15.hdf5',
 '12.hdf5']
>>> clear_tables()
>>> os.listdir(MPI_TABLE_DIR)
[]
skysearcher.skysearch_lib.pause(rnk=0)[source]

Slow down MPI process according to their rank.

Parameters: rnk (int, optional) – Integer representing MPI process rank

Example

>>> skysearcher.skysearch_lib import pause
>>> pause(rnk=1)
skysearcher.skysearch_lib.clear_tables(_target_dir)[source]

Clear all MPI temp tables from MPI_TABLE_DIR before creating new ones.

Parameters:

_target_dir (str, optional) – PATH to target directory.

Raises:

Example

>>> from skysearcher.skysearch_lib import *
>>> import os
>>> os.listdir(MPI_TABLE_DIR)
['17.hdf5',
 '2.hdf5',
 '11.hdf5',
 ...,
 '0.hdf5',
 '15.hdf5',
 '12.hdf5']
>>> clear_tables()
>>> os.listdir(MPI_TABLE_DIR)
[]
skysearcher.skysearch_lib.grid_list()[source]

Load file handles for numpy data arrays.

Provide a list of all available numpy data arrays (grids).

Returns: List of grids to be used in search. (halo, PATH)
Return type: list

Example

>>> from skysearcher.skysearch_lib import *
>>> grids = grid_list()
>>> grids
[('halo07', '$PATH/skysearcher/data/grids/halo07_4.0Mpc_h158_grid.npy'),
 ('halo09', '$PATH/skysearcher/data/grids/halo09_4.0Mpc_h158_grid.npy'),
 ('halo20', '$PATH/skysearcher/data/grids/halo20_4.0Mpc_h158_grid.npy'),
 ...
 ('halo08', '$PATH/skysearcher/data/grids/halo08_4.0Mpc_h158_grid.npy'),
 ('halo15', '$PATH/skysearcher/data/grids/halo15_4.0Mpc_h158_grid.npy'),
 ('halo02', '$PATH/skysearcher/data/grids/halo02_4.0Mpc_h158_grid.npy')]
skysearcher.skysearch_lib.kpc_to_arcmin[source]

Make the mod for the distance.

Convert Kpc to Arc-min.

Parameters: d_mpc (float, optional) – Distance in Mpc.
Returns: Ratio of Kpc to Arc-min.
Return type: float

Example

>>> from skysearcher.skysearch_lib import kpc_to_arcmin
>>> mod = kpc_to_arcmin(d_mpc=4.0)
>>> mod
0.7386310975322501
skysearcher.skysearch_lib.record_table(_names=[('halo', 'i'), ('radius', 'i'), ('r0', 'f'), ('r1', 'f'), ('annuli_step', 'f'), ('Log10(mu)', 'f'), ('xbox_max', 'f'), ('Log10(n_stars_max)', 'f'), ('domsat_purity', 'f'), ('domsat_id', 'i'), ('domsat_sig', 'f'), ('nsats', 'f'), ('domsat_mass', 'f'), ('domsat_atime', 'f'), ('domsat_j', 'f'), ('deg0', 'f'), ('extent', 'f')], _meta=True)[source]

Load the record table (r_table).

Make a new astropy table to use for MPI output.

Parameters:
  • _names (list, optional) – List of column names and data types to be used. (column name, dtype)
  • _meta (bool, optional) – Attach meta data to table or not.
Returns:

Record table to use for storing MPI data.

Return type:

astropy.tables.Table

Example

>>> from skysearcher.skysearch_lib import *
>>> record_table(_names=TABLE_COLUMNS)
<Table length=0>
 halo radius    r0      r1   annuli_step ... domsat_atime domsat_j   deg0   extent
int32 int32  float32 float32   float32   ...   float32    float32  float32 float32
----- ------ ------- ------- ----------- ... ------------ -------- ------- -------
skysearcher.skysearch_lib.radii()[source]

Load list of radii (_radii). i.e radii[x] = (r, r_start, r_stop)

The list of radii to search. Set from rc.cfg file.

Returns: List of radii in the form (center, inner, outer)
Return type: list

Example

>>> from skysearcher.skysearch_lib import radii
>>> _radii = radii()
>>> _radii
[(5, 4.75, 5.25),
 (6, 5.7, 6.3),
 (7, 6.65, 7.35),
 ...
 (11, 10.45, 11.55),
 (12, 11.4, 12.6),
 (13, 12.35, 13.65)]
skysearcher.skysearch_lib.save_record_table(_table, _rnk=0)[source]

Save record hdf5 table.

Parameters:
  • _table (astropy.table.Table) – Data table for storing search data
  • _rnk (int, optional) – MPI_RANK
Raises:
  • IOError – Description
  • TypeError – Missing 1 required positional argument: ‘_table’

Example

>>> from skysearcher.skysearch_lib import *
>>> r_table = record_table(_names=TABLE_COLUMNS)
>>> save_record_table(_table=r_table)
skysearcher.skysearch_lib.fix_rslice(_grid, _dtype=<class 'numpy.float32'>)[source]

Summary

Parameters:
  • _grid (TYPE) – Description
  • _dtype (TYPE, optional) – Description
Returns:

Description

Return type:

TYPE

Raises:

IndexError – Description

skysearcher.skysearch_lib.load_grid(_grid_fh)[source]

Get the data grid for this halo (grid).

Parameters: _grid_fh (str) – File handle (absolute PATH) for a grid file.
Returns: List of Tuples [(halo_name, halo_data_path), …]
Return type: list

Example

>>> from skysearcher.skysearch_lib import *
>>> grids = grid_list()
>>> grid_info = grids[0]
>>> grid_info
('halo07',
 '$PATH/skysearcher/data/grids/halo07_4.0Mpc_h158_grid.npy')
>>> halo, grid_fh = grid_info
>>> halo
'halo07'
>>> grid_fh
'$PATH/skysearcher/data/grids/halo07_4.0Mpc_h158_grid.npy'
>>> grid = load_grid(grid_fh)
>>> grid
array([[[   0., 0., 0., ..., 0., 423.55697632, -2.3561945 ],
        [   0., 0., 0., ..., 0., 422.85043335, -2.35786676],
        [   0., 0., 0., ..., 0., 422.14511108, -2.35954452],
        ...,
        [   0., 0., 0., ..., 0., 422.14511108, 2.35954452],
        [   0., 0., 0., ..., 0., 422.85043335, 2.35786676],
        [   0., 0., 0., ..., 0., 423.55697632, 2.3561945 ]
        ],
       [[   0., 0., 0., ..., 0., 422.85043335, -2.35452223],
        [   0., 0., 0., ..., 0., 422.14276123, -2.3561945 ],
        [   0., 0., 0., ..., 0., 421.43624878, -2.35787249],
        ...,
        [   0., 0., 0., ..., 0., 421.43624878, 2.35787249],
        [   0., 0., 0., ..., 0., 422.14276123, 2.3561945 ],
        [   0., 0., 0., ..., 0., 422.85043335, 2.35452223]
        ],
       [[   0., 0., 0., ..., 0., 422.14511108, -2.35284448],
        [   0., 0., 0., ..., 0., 421.43624878, -2.35451674],
        [   0., 0., 0., ..., 0., 420.72854614, -2.3561945 ],
        ...,
        [   0., 0., 0., ..., 0., 420.72854614, 2.3561945 ],
        [   0., 0., 0., ..., 0., 421.43624878, 2.35451674],
        [   0., 0., 0., ..., 0., 422.14511108, 2.35284448]],
        ...,
       [[   0., 0., 0., ..., 0., 422.14511108, -0.7887482 ],
        [   0., 0., 0., ..., 0., 421.43624878, -0.787076  ],
        [   0., 0., 0., ..., 0., 420.72854614, -0.78539819],
        ...,
        [   0., 0., 0., ..., 0., 420.72854614, 0.78539819],
        [   0., 0., 0., ..., 0., 421.43624878, 0.787076  ],
        [   0., 0., 0., ..., 0., 422.14511108, 0.7887482 ]
        ],
       [[   0., 0., 0., ..., 0., 422.85043335, -0.78707045],
        [   0., 0., 0., ..., 0., 422.14276123, -0.78539819],
        [   0., 0., 0., ..., 0., 421.43624878, -0.78372031],
        ...,
        [   0., 0., 0., ..., 0., 421.43624878, 0.78372031],
        [   0., 0., 0., ..., 0., 422.14276123, 0.78539819],
        [   0., 0., 0., ..., 0., 422.85043335, 0.78707045]
        ],
       [[   0., 0., 0., ..., 0., 423.55697632, -0.78539819],
        [   0., 0., 0., ..., 0., 422.85043335, -0.78372592],
        [   0., 0., 0., ..., 0., 422.14511108, -0.78204811],
        ...,
        [   0., 0., 0., ..., 0., 422.14511108, 0.78204811],
        [   0., 0., 0., ..., 0., 422.85043335, 0.78372592],
        [   0., 0., 0., ..., 0., 423.55697632, 0.78539819]
       ]], dtype=float32)
>>> grid.shape
(600, 600, 7)
skysearcher.skysearch_lib.satid_setup(_halo, attempts=0)[source]

Get a list of satid’s and a table for counting satids per region (satid_list) (satid_table).

Parameters:
  • _halo (str) – Halo name i.e. “halo02”
  • attempts (int, optional) – No longer used.
Returns:

(list, astropy.table.Table)

Return type:

tuple

Raises:
  • OSError – Unable to open file. No such file or directory.
  • TypeError – Missing 1 required positional argument: ‘_halo’

Example

>>> from skysearcher.skysearch_lib import *
>>> halo = "halo07"
>>> satid_list, satid_table = satid_setup(halo)
>>> satid_list
[215,
 217,
 218,
 ...,
 316,
 317,
 318]
>>> satid_table
<Table length=8243050>
satids    Phi     Rads
int16     rad     kpc
uint16  float16  uint16
------ --------- ------
   225   -3.0566    229
   225   -3.0605    229
   254   -3.0664    229
   ...       ...    ...
   225  0.076111    229
   225  0.080444    229
   225  0.084778    229
>>> satid_table.keys()
['satids', 'Phi', 'Rads']
>>> satid_table["satids"].min() >= min(satid_list)
True
>>> satid_table["satids"].max() <= max(satid_list)
True
skysearcher.skysearch_lib.mu_idx(_grid, _r0, _r1)[source]

Get the mean number of stars for this annulus (mu) and an array of indices’s representing the corresponding array segments (r_idx).

Parameters:
  • _grid (numpy.ndarray) – The data grid for this halo (grid)
  • _r0 (float) – Starting radius (always < r)
  • _r1 (float) – Ending radius (always > r)
Returns:

(float, numpy.ndarray)

Return type:

tuple

Example

>>> from skysearcher.skysearch_lib import *
>>> grids = grid_list()
>>> grid_info = grids[0]
>>> halo, grid_fh = grid_info
>>> grid = load_grid(grid_fh)
>>> _radii = radii()
>>> r, r_start, r_stop = _radii[0]
>>> mu, r_idx = mu_idx(grid, r_start, r_stop)
>>> mu
6650.8335
>>> r_idx
array([[False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       ...,
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False]], dtype=bool)
skysearcher.skysearch_lib.mu_idx2(_grid, _r_indx, d0, d1)[source]

Get the mean number of stars for this sub-annulus-section (mu) and the array indices’s for the corresponding array elements (r_idx2).

Parameters:
  • _grid (numpy.ndarray) – The data grid for this halo (grid)
  • _r_indx (numpy.ndarray) – Indices’s of array elements within the current annulus.
  • d0 (float) – Starting point (-pi, pi].
  • d1 (float) – Ending point (-pi, pi].
Returns:

float, numpy.ndarray

Return type:

tuple

Example

>>> from skysearcher.skysearch_lib import *
>>> grids = grid_list()
>>> grid_info = grids[0]
>>> halo, grid_fh = grid_info
>>> grid = load_grid(grid_fh)
>>> grid
array([[[   0., 0., 0., ..., 0., 423.55697632, -2.3561945 ],
        [   0., 0., 0., ..., 0., 422.85043335, -2.35786676],
        [   0., 0., 0., ..., 0., 422.14511108, -2.35954452],
        ...,
        [   0., 0., 0., ..., 0., 422.14511108, 2.35954452 ],
        [   0., 0., 0., ..., 0., 422.85043335, 2.35786676 ],
        [   0., 0., 0., ..., 0., 423.55697632, 2.3561945  ]
        ],
       [[   0., 0., 0., ..., 0., 422.85043335, -2.35452223],
        [   0., 0., 0., ..., 0., 422.14276123, -2.3561945 ],
        [   0., 0., 0., ..., 0., 421.43624878, -2.35787249],
        ...,
        [   0., 0., 0., ..., 0., 421.43624878, 2.35787249 ],
        [   0., 0., 0., ..., 0., 422.14276123, 2.3561945  ],
        [   0., 0., 0., ..., 0., 422.85043335, 2.35452223 ]
        ],
       [[   0., 0., 0., ..., 0., 422.14511108, -2.35284448],
        [   0., 0., 0., ..., 0., 421.43624878, -2.35451674],
        [   0., 0., 0., ..., 0., 420.72854614, -2.3561945 ],
        ...,
        [   0., 0., 0., ..., 0., 420.72854614, 2.3561945  ],
        [   0., 0., 0., ..., 0., 421.43624878, 2.35451674 ],
        [   0., 0., 0., ..., 0., 422.14511108, 2.35284448 ]],
        ...,
       [[   0., 0., 0., ..., 0., 422.14511108, -0.7887482 ],
        [   0., 0., 0., ..., 0., 421.43624878, -0.787076  ],
        [   0., 0., 0., ..., 0., 420.72854614, -0.78539819],
        ...,
        [   0., 0., 0., ..., 0., 420.72854614, 0.78539819 ],
        [   0., 0., 0., ..., 0., 421.43624878, 0.787076   ],
        [   0., 0., 0., ..., 0., 422.14511108, 0.7887482  ]
        ],
       [[   0., 0., 0., ..., 0., 422.85043335, -0.78707045],
        [   0., 0., 0., ..., 0., 422.14276123, -0.78539819],
        [   0., 0., 0., ..., 0., 421.43624878, -0.78372031],
        ...,
        [   0., 0., 0., ..., 0., 421.43624878, 0.78372031 ],
        [   0., 0., 0., ..., 0., 422.14276123, 0.78539819 ],
        [   0., 0., 0., ..., 0., 422.85043335, 0.78707045 ]
        ],
       [[   0., 0., 0., ..., 0., 423.55697632, -0.78539819],
        [   0., 0., 0., ..., 0., 422.85043335, -0.78372592],
        [   0., 0., 0., ..., 0., 422.14511108, -0.78204811],
        ...,
        [   0., 0., 0., ..., 0., 422.14511108, 0.78204811 ],
        [   0., 0., 0., ..., 0., 422.85043335, 0.78372592 ],
        [   0., 0., 0., ..., 0., 423.55697632, 0.78539819 ]
       ]], dtype=float32)
>>> grid.shape
(600, 600, 7)
>>> _radii = radii()
>>> r, r_start, r_stop = _radii[0]
>>> r
5
>>> r_start
4.75
>>> r_stop
5.25
>>> mu, r_idx = mu_idx(grid, r_start, r_stop)
>>> mu
6650.8335
>>> r_idx
array([[False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       ...,
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False]], dtype=bool)
>>> annuli, annuli_step = get_annuli(r)
>>> annuli
[(-3.1730085801256909, -3.1642795331377247),
 (-3.1642795331377247, -3.1555504861497585),
 (-3.1555504861497585, -3.1468214391617924),
 ...,
 (3.1468214391617924, 3.1555504861497585),
 (3.1555504861497585, 3.1642795331377247),
 (3.1642795331377247, 3.1730085801256909)]
>>> annuli_step
0.0087290469879661367
>>> _deg0, _deg1 = annuli[0]
>>> _deg0
-3.1730085801256909
>>> _deg1
-3.1642795331377247
>>> mu, r_idx2 = mu_idx2(grid, r_idx, _deg0, _deg1)
>>> mu
1.0
>>> r_idx2
array([[False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       ...,
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False]], dtype=bool)
skysearcher.skysearch_lib.get_annuli(_r)[source]

Load array of annuli segments and step value (annuli) & ( annuli_step).

Parameters: _r (int) – Radius Kpc.
Returns:
(list of tuples, float)
list of tuples: annuli_step = float annuli[x] = (deg_0, deg_1) annuli, annuli_step
Return type: tuple

Example

>>> from skysearcher.skysearch_lib import *
>>> r = 10
>>> annuli, annuli_step = get_annuli(r)
>>> annuli
[(-3.1730085801256909, -3.1642795331377247),
 (-3.1642795331377247, -3.1555504861497585),
 (-3.1555504861497585, -3.1468214391617924),
 ...
 (3.1468214391617924, 3.1555504861497585),
 (3.1555504861497585, 3.1642795331377247),
 (3.1642795331377247, 3.1730085801256909)]
>>> annuli_step
0.0086340369527229677
skysearcher.skysearch_lib.get_idx[source]

The grid index for grid spaces within this segment (idx).

Parameters:
  • _grid (numpy.ndarray) – The data grid for this halo (grid).
  • _d0 (float) – Starting point.
  • _d1 (float) – Ending point.
  • _ridx (numpy.ndarray) – An array of indices’s representing the corresponding array segments.
Returns:

Return type:

numpy.ndarray

Example

>>> from skysearcher.skysearch_lib import *
>>> grids = grid_list()
>>> grid_info = grids[0]
>>> halo, grid_fh = grid_info
>>> grid = load_grid(grid_fh)
>>> grid
array([[[   0., 0., 0., ..., 0., 423.55697632, -2.3561945 ],
        [   0., 0., 0., ..., 0., 422.85043335, -2.35786676],
        [   0., 0., 0., ..., 0., 422.14511108, -2.35954452],
        ...,
        [   0., 0., 0., ..., 0., 422.14511108, 2.35954452 ],
        [   0., 0., 0., ..., 0., 422.85043335, 2.35786676 ],
        [   0., 0., 0., ..., 0., 423.55697632, 2.3561945  ]
        ],
       [[   0., 0., 0., ..., 0., 422.85043335, -2.35452223],
        [   0., 0., 0., ..., 0., 422.14276123, -2.3561945 ],
        [   0., 0., 0., ..., 0., 421.43624878, -2.35787249],
        ...,
        [   0., 0., 0., ..., 0., 421.43624878, 2.35787249 ],
        [   0., 0., 0., ..., 0., 422.14276123, 2.3561945  ],
        [   0., 0., 0., ..., 0., 422.85043335, 2.35452223 ]
        ],
       [[   0., 0., 0., ..., 0., 422.14511108, -2.35284448],
        [   0., 0., 0., ..., 0., 421.43624878, -2.35451674],
        [   0., 0., 0., ..., 0., 420.72854614, -2.3561945 ],
        ...,
        [   0., 0., 0., ..., 0., 420.72854614, 2.3561945  ],
        [   0., 0., 0., ..., 0., 421.43624878, 2.35451674 ],
        [   0., 0., 0., ..., 0., 422.14511108, 2.35284448 ]],
        ...,
       [[   0., 0., 0., ..., 0., 422.14511108, -0.7887482 ],
        [   0., 0., 0., ..., 0., 421.43624878, -0.787076  ],
        [   0., 0., 0., ..., 0., 420.72854614, -0.78539819],
        ...,
        [   0., 0., 0., ..., 0., 420.72854614, 0.78539819 ],
        [   0., 0., 0., ..., 0., 421.43624878, 0.787076   ],
        [   0., 0., 0., ..., 0., 422.14511108, 0.7887482  ]
        ],
       [[   0., 0., 0., ..., 0., 422.85043335, -0.78707045],
        [   0., 0., 0., ..., 0., 422.14276123, -0.78539819],
        [   0., 0., 0., ..., 0., 421.43624878, -0.78372031],
        ...,
        [   0., 0., 0., ..., 0., 421.43624878, 0.78372031 ],
        [   0., 0., 0., ..., 0., 422.14276123, 0.78539819 ],
        [   0., 0., 0., ..., 0., 422.85043335, 0.78707045 ]
        ],
       [[   0., 0., 0., ..., 0., 423.55697632, -0.78539819],
        [   0., 0., 0., ..., 0., 422.85043335, -0.78372592],
        [   0., 0., 0., ..., 0., 422.14511108, -0.78204811],
        ...,
        [   0., 0., 0., ..., 0., 422.14511108, 0.78204811 ],
        [   0., 0., 0., ..., 0., 422.85043335, 0.78372592 ],
        [   0., 0., 0., ..., 0., 423.55697632, 0.78539819 ]
       ]], dtype=float32)
>>> grid.shape
(600, 600, 7)
>>> _radii = radii()
>>> r, r_start, r_stop = _radii[0]
>>> r
5
>>> r_start
4.75
>>> r_stop
5.25
>>> mu, r_idx = mu_idx(grid, r_start, r_stop)
>>> mu
6650.8335
>>> r_idx
array([[False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       ...,
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False]], dtype=bool)
>>> annuli, annuli_step = get_annuli(r)
>>> annuli
[(-3.1730085801256909, -3.1642795331377247),
 (-3.1642795331377247, -3.1555504861497585),
 (-3.1555504861497585, -3.1468214391617924),
 ...,
 (3.1468214391617924, 3.1555504861497585),
 (3.1555504861497585, 3.1642795331377247),
 (3.1642795331377247, 3.1730085801256909)]
>>> annuli_step
0.0087290469879661367
>>> _deg0, _deg1 = annuli[0]
>>> _deg0
-3.1730085801256909
>>> _deg1
-3.1642795331377247
>>> mu, r_idx2 = mu_idx2(grid, r_idx, _deg0, _deg1)
>>> mu
1.0
>>> r_idx2
array([[False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       ...,
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False],
       [False, False, False, ..., False, False, False]], dtype=bool)
>>> idx = get_idx(grid, _deg0, _deg1, r_idx2)
(array([], dtype=int64), array([], dtype=int64))
>>> type(idx)
tuple
>>> type(idx[0])
numpy.ndarray
skysearcher.skysearch_lib.get_xbox[source]

The array of grid spaces from this segment’s contrast density value (xbox).

Parameters:
  • _grid (numpy.ndarray) – The data grid for this halo (grid)
  • _idx (numpy.ndarray) –
  • _mu (float) – Mean number of stars per array element
Returns:

Return type:

numpy.ndarray

Example

>>> n_boxes_in_seg = len(idx[0])
>>> xbox = get_xbox(grid, idx, mu)
>>> n_stars_here = grid[:, :, 1][idx].sum()
skysearcher.skysearch_lib.new_sat_stars(_id_lst)[source]

Start a dictionary for counting stars per satid (sat_stars).

Parameters: _id_lst (list) – List of satid’s‘ for this halo
Returns: Dictionary with satid’s for keys and corresponding number of stars for each satid counted.
Return type: dict

Example

>>> sat_stars = new_sat_stars(satid_list)
>>> sat_stars
{0: 0,
 1: 0,
 2: 0,
 3: 0,
 ...
 110: 0,
 111: 0,
 112: 0}
skysearcher.skysearch_lib.count_strs[source]

Count stars per satid.

Parameters:
Returns:

An updated sat_stars dictionary with satid’s for keys and corresponding number of stars for each satid counted.

Return type:

dict

Example

>>> sat_stars = new_sat_stars(satid_list)
>>> local_satid_table = satid_table[np.logical_and(
...:   satid_table["Rads"] >= r_start,
...:   satid_table["Rads"] < r_stop)]
>>> r_info = [r_start, r_stop, _deg0, _deg1]
>>> sat_stars = count_strs(sat_stars, r_info, local_satid_table)
skysearcher.skysearch_lib.dom_satid(input_dict, _dict, rtn=False)[source]

The dominate satellite number (domsat_id). Domsats’s % of all stars (domsat_purity).

Parameters: _dict (dict) – A dictionary for counting stars per satid (sat_stars).
Returns: (_domsat_id, _domsat_per, _standout, n_sats) _domsat_id : Dominate satellite id. _domsat_per : Percentage that the _domsat_id represents from all satid’s. _standout : _domsat_per / 0.01 n_sats : Number of staid’s present.
Return type: tuple

Example

>>> domsat_id, domsat_purity, standout, nsats = dom_satid(sat_stars)
skysearcher.skysearch_lib.report(_type, _info)[source]

_dict = sorted(_dict, key=_dict.__getitem__, reverse=True) if _type == “starting halo”: STDOUT.write(“rank ” + str(MPI_RANK) + ” [ LOADED ] ” + halo + “n”) STDOUT.flush() if _type == “end annulus”: line = (“rank ” + str(MPI_RANK) + ” : halo” + halo[-2:] + ” - ” + str(round(r, 1)) + ” Kpc : –> ” + str(round((time() - a_tic), 1)) + ” secs”) STDOUT.write(line + “n”) STDOUT.flush if _type == “end halo”: if _type == “exit”: msg = (“rank ” + str(MPI_RANK) + ” [ FINISHED ] [ ” + str(round((time() - tic) / 60.0, 1)) + ” minutes ]n”) STDOUT.write(msg) STDOUT.flush() –> TIME

skysearcher.mpi_search.main()[source]

This is the main parallel skysearcher program.

Example

>>> mpiexec -n <nproc> -machinefile <mf> python mpi_search.py

-nproc {int} – number of processes -machinefile {file} – list of hosts each on a new line

skysearcher.new_cfg.new_rc(rc_fh=None, output=True, tbl_ext='hdf5')[source]

Create a new rc configuration file to the provided file handle.

Parameters:
  • rc_fh (None, optional) – File name of the output config file.
  • tbl_ext (str, optional) – Description
  • output (bool, optional) – If True then print newly generated configfile contents to sdout.
Keyword Arguments:
 
  • {str} -- full path and name of rc file (default (rc_fh) –
  • {str} -- extention for tables. (default (tbl_ext) –
Returns:

Return type:

rc file handle str.

Example

>>> import ConfigParser
>>> config = ConfigParser.RawConfigParser()
>>> config.read("rc.cfg")
user@machine$ python new_cfg.py
[ PATH ]
data_dir = ~/$USER/skysearcher/data
plot_dir = ~/$USER/skysearcher/data/plots
table_dir = ~/$USER/skysearcher/data/tables
mpi_table_dir = ~/$USER/skysearcher/data/tables/groupfinder/mpi
grid_dir = ~/$USER/skysearcher/data/grids
grid_file_designator = grid
grid_ext = npy
table_file_designator = table
table_format = hdf5
table_hdf5_path = data
table_ext = .hdf5

[ Search Extent ]
r_start = 5
r_stop = 285
r_step = 1
annulus_scale = 0.05
annulus_phi_step = 720

[ Accept Reject ]
xbox_cut = 0.1
min_log_nstars = 2.00
min_n_segments = 4
n_skips = 2

[ Run Time ]
save_interval = 2

[ Data ]
d_mpc = 4.0

Index