pycorrelator.tests package

pycorrelator.tests.test_catalog module

class pycorrelator.tests.test_catalog.TestCatalog_InvalidInput(methodName='runTest')[source]

Bases: TestCase

test_invalid_type()[source]
test_np_contains_inf()[source]
test_np_shape_1d()[source]
test_np_shape_2x3()[source]
test_pd_column_missing_dec()[source]
test_pd_column_missing_ra()[source]
test_pd_contains_nan()[source]
class pycorrelator.tests.test_catalog.TestCatalog_RandomCheckInputOutput(methodName='runTest')[source]

Bases: TestCase

static get_input_output_pair(N)[source]
test_random_np()[source]
test_random_pd()[source]
class pycorrelator.tests.test_catalog.TestCatalog_ValidInput(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_np()[source]
test_pd()[source]
test_pd_column_name_lower()[source]
test_pd_column_name_mixed()[source]
test_pd_column_name_upper()[source]

pycorrelator.tests.test_chunk module

class pycorrelator.tests.test_chunk.TestChunkGeneratorByGrid_coor2id_boundary(methodName='runTest')[source]

Bases: TestCase

test_middle_chunks_boundaries()[source]
test_objects_outside_tolerance_boundary()[source]
test_polar_chunks_boundaries()[source]
class pycorrelator.tests.test_chunk.TestChunkGeneratorByGrid_coor2id_central(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_boundaries()[source]
test_middle_chunks_north()[source]
test_middle_chunks_south()[source]
test_polar_regions()[source]
class pycorrelator.tests.test_chunk.TestChunkIntegratingFoF(methodName='runTest')[source]

Bases: TestCase

group_by_quadtree_scipy(objects_df: DataFrame, tolerance, chunk_gen)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_different_chunk()[source]

pycorrelator.tests.test_fof module

class pycorrelator.tests.test_fof.TestCelestialGrouping(methodName='runTest')[source]

Bases: TestCase

test_qt_grid_boundary()[source]
test_qt_high_density()[source]
test_qt_long_chain()[source]

Test result: Found round-off error in the code. The problem is fixed by setting a relative tolerance of 1e-8 in the np.isclose() function.

test_qt_random_tree()[source]
test_qt_random_walk()[source]
class pycorrelator.tests.test_fof.TestCelestialGrouping_Random(methodName='runTest')[source]

Bases: TestCase

test_comparing_chunk_setting()[source]
class pycorrelator.tests.test_fof.TestCelestialGrouping_RandomGrid(methodName='runTest')[source]

Bases: TestCase

Unit test for a celestial objects grouping method.

The purpose of this unit test is to ensure that a celestial objects grouping method works correctly. A grid on the celestial sphere is created with a size of 10 deg. Half of the grid points are randomly selected, and for each selected point, several points are created within a 1 deg circle around it using the point_offset() function. These points, with the central point, become a ‘group’. The tested function is then called, and its output is checked against the expected groups. If there’s a discrepancy, the problematic group is printed.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_group_by_quadtree()[source]
pycorrelator.tests.test_fof.check_group_match(expected_groups: list[list[tuple[float, float]]], output_groups)[source]

Check if two groups match.

Parameters:
  • expected_groups (list[list[tuple[float, float]]]) – List of groups that are expected to be grouped correctly.

  • output_groups (list[list[tuple[float, float]]]) – List of groups that are output by the tested function.

Returns:

problematic_groups – List of groups that the tested function failed to group correctly. If the tested function works correctly, an empty list is returned.

Return type:

list[list[tuple[float, float]]]

pycorrelator.tests.test_fof.create_groups_from_grid(grid: list[tuple[float, float]], tolerance=1, seed=None, fraction=0.5, ring_radius=(0, 1)) tuple[list[list[tuple[float, float]]], ndarray[Any, dtype[_ScalarType_co]]][source]

Randomly pick half of the grid points and create groups around them. For each selected grid point, use the point_offset() function to create several points within a tolerance (default 1 degree) circle around the central point. Returns a list of groups, where each group is a list of (RA, Dec) coordinates.

pycorrelator.tests.test_fof.generate_celestial_grid(**kwargs) list[tuple[float, float]][source]

Generate a grid on the celestial sphere with specified step sizes and bounds.

Keyword Arguments:
  • ra_step (float) – Step size for Right Ascension (default: 10).

  • dec_step (float) – Step size for Declination (default: 10).

  • ra_offset (float) – Offset for RA (default: 0).

  • dec_offset (float) – Offset for DEC (default: 0).

  • ra_bounds (tuple) – A tuple containing the lower and upper bounds for RA (default: (0, 360)).

  • dec_bounds (tuple | float) – A tuple containing the lower and upper bounds for DEC (default: (-60, 60)). Can also be an absolute value which will be interpreted as (value, -value).

Returns:

List of (RA, Dec) coordinates for the grid points.

Return type:

list[tuple[float, float]]

pycorrelator.tests.test_fof.print_format_group(groups)[source]

Format a list of celestial groups into the desired format and print them.

pycorrelator.tests.test_result_xmatch module

class pycorrelator.tests.test_result_xmatch.TestXMatchResult_Methods(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_get_dataframe1()[source]
test_get_dataframe1_min_match()[source]
test_get_dataframe1_retain_all_columns_False()[source]
test_get_dataframe1_retain_all_columns_True()[source]
test_get_dataframe1_retain_columns()[source]
test_get_dataframe2()[source]
test_get_multiindex_dataframe()[source]
test_get_result_dict()[source]
test_get_serial_dataframe()[source]
test_get_serial_dataframe_min_match()[source]
test_get_serial_dataframe_retain_all_columns()[source]
test_get_serial_dataframe_retain_columns()[source]
test_get_serial_dataframe_reverse()[source]

pycorrelator.tests.test_toolbox_spherical module

class pycorrelator.tests.test_toolbox_spherical.TestAngularDistance(methodName='runTest')[source]

Bases: TestCase

test_distance_near_wraparound_points()[source]
test_distance_north_south_poles()[source]
test_distance_random_point_north_pole()[source]
test_distance_random_point_south_pole()[source]
test_distance_wraparound_points()[source]
class pycorrelator.tests.test_toolbox_spherical.TestPointOffset(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_point_offsets()[source]
class pycorrelator.tests.test_toolbox_spherical.TestPointOffsetExtremeCases(methodName='runTest')[source]

Bases: TestCase

check_distance(point1, point2, expected_distance)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_north_pole_offsets()[source]
test_opposite_point_offsets()[source]
test_south_pole_offsets()[source]
test_tiny_distance_offsets()[source]
test_wraparound_direction_offsets()[source]
class pycorrelator.tests.test_toolbox_spherical.TestRotateRADEC(methodName='runTest')[source]

Bases: TestCase

test_full_rotation()[source]
test_multiple_rotations()[source]
test_no_rotation()[source]
test_perpendicular_rotation()[source]
test_rotation_about_itself()[source]
test_rotation_about_pole()[source]
test_small_angle_rotation()[source]
test_south_pole_rotation()[source]

pycorrelator.tests.test_xmatch module

Module contents