hipars package
hipars.Sorting module
- class hipars.Sorting.Sorting
Bases:
objectPython wrapper class for sorting arrays of neutral atoms
- fix_lattice_by_row_sorting_deficiencies(state_array: ndarray, target_geometry: ndarray[TargetState])
Function for fixing sorting deficiencies arising during sort_parallel_lattice_by_row. May only be called on the same Sorting object on which sort_parallel_lattice_by_row was previously called.
- Parameters:
state_array (np.ndarray[bool]) – The array of boolean values to be sorted
target_geometry (np.ndarray[resorting_cpp.TargetState]) – The array of target state values specifying the target geometry
- Returns:
A list of moves to sort array or None if sorting has failed. A ParallelMove contains .steps, which is a list of ParallelMoveStep objects, each containing .colSelection and .rowSelection, which are lists of doubles
- Return type:
list[ParallelMove], optional
- flush_logs()
Function for flushing the logs
- read_config_file(file_path)
Function to pass a config file for the underlying sorting library
- Parameters:
file_path (str) – The path of the config file
- Raises:
TypeError – file_path must be a str
- Returns:
A list of moves to sort array or None if sorting has failed. A move contains .distance, .init_dir, and .sites_list, which is a list of coordinate pairs to traverse
- Return type:
bool, optional
- sort_parallel(state_array: ndarray, comp_zone_row_range: tuple[int, int], comp_zone_col_range: tuple[int, int], target_geometry: ndarray | None = None)
Function for sorting in parallel
- Parameters:
state_array (np.ndarray[bool]) – The array of boolean values to be sorted
comp_zone_row_range (tuple(int,int)) – Tuple (start,end) of start(inclusive) and end(exclusive) of rows in computational zone
comp_zone_col_range (tuple(int,int)) – Tuple (start,end) of start(inclusive) and end(exclusive) of columns in computational zone
target_geometry (np.ndarray[bool] | None) – The array of boolean values specifying the target geometry. Assume all true if None
- Raises:
TypeError – state_array must be numpy bool array
TypeError – state_array must be dtype bool
- Returns:
A list of moves to sort array or None if sorting has failed. A ParallelMove contains .steps, which is a list of ParallelMoveStep objects, each containing .colSelection and .rowSelection, which are lists of doubles
- Return type:
list[ParallelMove], optional
- sort_parallel_lattice_by_row(state_array: ndarray, target_geometry: ndarray[TargetState])
Function for sorting lattice geometries row by row
- Parameters:
state_array (np.ndarray[bool]) – The array of boolean values to be sorted
target_geometry (np.ndarray[resorting_cpp.TargetState]) – The array of target state values specifying the target geometry
- Returns:
A list of moves to sort array or None if sorting has failed. A ParallelMove contains .steps, which is a list of ParallelMoveStep objects, each containing .colSelection and .rowSelection, which are lists of doubles
- Return type:
list[ParallelMove], optional
- sort_parallel_lattice_greedy(state_array: ndarray, comp_zone_row_range: tuple[int, int], comp_zone_col_range: tuple[int, int], target_geometry: ndarray | None)
Function for sorting in parallel
- Parameters:
state_array (np.ndarray[bool]) – The array of boolean values to be sorted
comp_zone_row_range (tuple(int,int)) – Tuple (start,end) of start(inclusive) and end(exclusive) of rows in computational zone
comp_zone_col_range (tuple(int,int)) – Tuple (start,end) of start(inclusive) and end(exclusive) of columns in computational zone
target_geometry (np.ndarray[bool]) – The array of boolean values specifying the target geometry
- Raises:
TypeError – state_array must be numpy bool array
TypeError – state_array must be dtype bool
TypeError – target_geometry must be numpy bool array
TypeError – target_geometry must be dtype bool
- Returns:
A list of moves to sort array or None if sorting has failed. A ParallelMove contains .steps, which is a list of ParallelMoveStep objects, each containing .colSelection and .rowSelection, which are lists of doubles
- Return type:
list[ParallelMove], optional
- sort_sequentially(state_array: ndarray, comp_zone_row_range: tuple[int, int], comp_zone_col_range: tuple[int, int])
Function for sorting sequentially
- Parameters:
state_array (np.ndarray[bool]) – The array of boolean values to be sorted
comp_zone_row_range (tuple(int,int)) – Tuple (start,end) of start(inclusive) and end(exclusive) of rows in computational zone
comp_zone_col_range (tuple(int,int)) – Tuple (start,end) of start(inclusive) and end(exclusive) of columns in computational zone
- Raises:
TypeError – state_array must be numpy bool array
TypeError – state_array must be dtype bool
- Returns:
A list of moves to sort array or None if sorting has failed. A move contains .distance, .init_dir, and .sites_list, which is a list of coordinate pairs to traverse
- Return type:
list[SequentialMove], optional