Module: search#
- class kbmod.search.DebugTimer#
Bases:
pybind11_object
A simple timer used for consistent outputing of timing results in verbose mode. Timer automatically starts when it is created.
- Parameters:
- namestr
The name string of the timer. Used for ouput.
- verbosebool
Output the timing information to the standard output.
Methods
read
(self)Read the timer duration as decimal seconds.
start
(self)Start (or restart) the timer.
stop
(self)Stop the timer.
- read(self: kbmod.search.DebugTimer) float #
Read the timer duration as decimal seconds.
- Returns:
- durationfloat
The duration of the timer.
- start(self: kbmod.search.DebugTimer) None #
Start (or restart) the timer. If verbose=True, the object outputs a message.
- stop(self: kbmod.search.DebugTimer) None #
Stop the timer. If verbose=True, the object outputs the duration.
- class kbmod.search.PsiPhi#
Bases:
pybind11_object
A named tuple for psi and phi values.
- Attributes:
- psifloat
The psi value at a pixel.
- phifloat
The phi value at a pixel.
- class kbmod.search.PsiPhiArray#
Bases:
pybind11_object
An encoded array of Psi and Phi values along with their meta data. This object supports automatic encoding of the psi/phi values (into float, uint8, or uint16) as well as the transfer of data to the GPU.
- Attributes:
block_size
The size of a single entry in bytes.
cpu_array_allocated
A Boolean indicating whether the cpu data (psi/phi) array exists.
gpu_array_allocated
A Boolean indicating whether the gpu data (psi/phi) array exists.
height
The image height in pixels.
num_bytes
The target number of bytes to use for encoding the data (1 for uint8, 2 for uint16, or 4 for float32).
num_entries
The number of array entries (width x height x num_images).
num_times
The number of times.
on_gpu
A Boolean indicating whether a copy of the data is on the GPU.
phi_max_val
The maximum value of phi used in the scaling computations.
phi_min_val
The minimum value of phi used in the scaling computations.
phi_scale
The scaling parameter for phi.
pixels_per_image
The number of pixels per each image (width x height).
psi_max_val
The maximum value of psi used in the scaling computations.
psi_min_val
The minimum value of psi used in the scaling computations.
psi_scale
The scaling parameter for psi.
total_array_size
The size of the array in bytes.
width
The image width in pixels.
Methods
clear
(self)Clear all data and free the arrays.
clear_from_gpu
(self)Free the image and time data from the GPU memory.
move_to_gpu
(self)Move the image and time data to the GPU.
read_psi_phi
(self, arg0, arg1, arg2)Read a PsiPhi value from the CPU array.
read_time
(self, arg0)Read a zeroed time value from the CPU array.
set_meta_data
(self, arg0, arg1, arg2, arg3)Set the meta data for the array.
set_time_array
(self, arg0)Set the zeroed times.
- property block_size#
The size of a single entry in bytes.
- clear(self: kbmod.search.PsiPhiArray) None #
Clear all data and free the arrays.
- clear_from_gpu(self: kbmod.search.PsiPhiArray) None #
Free the image and time data from the GPU memory. Does not copy the data back to the CPU.
- Raises:
- Raises a RuntimeError the data or settings are invalid.
- property cpu_array_allocated#
A Boolean indicating whether the cpu data (psi/phi) array exists.
- property gpu_array_allocated#
A Boolean indicating whether the gpu data (psi/phi) array exists.
- property height#
The image height in pixels.
- move_to_gpu(self: kbmod.search.PsiPhiArray) None #
Move the image and time data to the GPU. Allocates space and copies the data.
- Raises:
- Raises a RuntimeError if the data or settings are invalid.
- property num_bytes#
The target number of bytes to use for encoding the data (1 for uint8, 2 for uint16, or 4 for float32). Might differ from actual number of bytes (block_size).
- property num_entries#
The number of array entries (width x height x num_images).
- property num_times#
The number of times. Equivalent to the number of images stored.
- property on_gpu#
A Boolean indicating whether a copy of the data is on the GPU.
- property phi_max_val#
The maximum value of phi used in the scaling computations.
- property phi_min_val#
The minimum value of phi used in the scaling computations.
- property phi_scale#
The scaling parameter for phi.
- property pixels_per_image#
The number of pixels per each image (width x height).
- property psi_max_val#
The maximum value of psi used in the scaling computations.
- property psi_min_val#
The minimum value of psi used in the scaling computations.
- property psi_scale#
The scaling parameter for psi.
- read_psi_phi(self: kbmod.search.PsiPhiArray, arg0: SupportsInt, arg1: SupportsInt, arg2: SupportsInt) kbmod.search.PsiPhi #
Read a PsiPhi value from the CPU array. Performs automatic decoding of compressed data and returns the value as a float.
- Parameters:
- timeint
The timestep to read.
- rowint
The row in the image (y-dimension)
- colint
The column in the image (x-dimension)
- Returns:
- PsiPhi
The pixel values.
- read_time(self: kbmod.search.PsiPhiArray, arg0: SupportsInt) float #
Read a zeroed time value from the CPU array.
- Parameters:
- timeint
The timestep to read.
- Returns:
- float
The time.
- set_meta_data(self: kbmod.search.PsiPhiArray, arg0: SupportsInt, arg1: SupportsInt, arg2: SupportsInt, arg3: SupportsInt) None #
Set the meta data for the array. Automatically called by fill_psi_phi_array().
- Parameters:
- new_num_bytesint
The type of encoding to use (1, 2, or 4).
- new_num_timesint
The number of time steps in the data.
- new_heightint
The height of each image in pixels.
- new_widthint
The width of each image in pixels.
- set_time_array(self: kbmod.search.PsiPhiArray, arg0: list[SupportsFloat]) None #
Set the zeroed times.
- Parameters:
- timeslist
A list of float with zeroed times.
- property total_array_size#
The size of the array in bytes.
- property width#
The image width in pixels.
- class kbmod.search.StackSearch#
Bases:
pybind11_object
The data and configuration needed for KBMOD’s core search. It is created using either a reference to the
ImageStack
or lists of science, variance, and PSF information.- Parameters:
- sci_imgslist
A list of science images as numpy arrays.
- var_imgslist
A list of variance images as numpy arrays.
- psf_kernelslist
A list of PSF kernels as numpy arrays.
- zeroed_timeslist
A list of floating point times starting at zero.
- num_bytesint
The number of bytes to use for encoding the data. This is used to set the encoding level for the data copied to the GPU. The default value is -1, which means no encoding is done. The other options are 1 (uint8), 2 (uint16), and 4 (float).
- Attributes:
- num_imagesint
The number of images (or time steps).
- heightint
The height of each image in pixels.
- widthint
The width of each image in pixels.
- zeroed_timeslist
The times shift so the first time is at 0.0.
Methods
clear_results
(self)Clear the saved results.
compute_max_results
(self)Compute the maximum number of results according to the x, y bounds and the results per pixel.
Turns off the on-GPU sigma-G filtering.
enable_gpu_sigmag_filter
(self, arg0, arg1, arg2)Enable on-GPU sigma-G filtering.
evaluate_single_trajectory
(self, arg0, arg1)Performs the evaluation of a single Trajectory object.
get_all_psi_phi_curves
(self, arg0)Return a single matrix with both the psi and phi curves.
get_all_results
(self)Get a reference to the full list of results.
get_image_height
(self)Returns the height of the images in pixels.
get_image_width
(self)Returns the width of the images in pixels.
get_num_images
(self)Returns the number of images to process.
get_number_total_results
(self)Get the total number of saved results.
get_results
(self, arg0, arg1)Get a batch of cached results.
search_all
(self, arg0, arg1)Perform the KBMOD search by evaluating a list of candidate trajectories at each starting pixel in the image.
search_linear_trajectory
(self, arg0, arg1, ...)Performs the evaluation of a linear trajectory in pixel space.
set_min_lh
(self, arg0)Sets the minimum likelihood for valid result.
set_min_obs
(self, arg0)Sets the minimum number of observations for valid result.
set_results
(self, arg0)Set the cached results.
set_results_per_pixel
(self, arg0)Set the maximum number of results per pixel returns by a search.
set_start_bounds_x
(self, arg0, arg1)Set the starting and ending bounds in the x direction for a grid search.
set_start_bounds_y
(self, arg0, arg1)Set the starting and ending bounds in the y direction for a grid search.
- clear_results(self: kbmod.search.StackSearch) None #
Clear the saved results.
- compute_max_results(self: kbmod.search.StackSearch) int #
Compute the maximum number of results according to the x, y bounds and the results per pixel.
- Returns:
- max_resultsint
The maximum number of results that a search will return.
- disable_gpu_sigmag_filter(self: kbmod.search.StackSearch) None #
Turns off the on-GPU sigma-G filtering.
- enable_gpu_sigmag_filter(self: kbmod.search.StackSearch, arg0: list[SupportsFloat], arg1: SupportsFloat, arg2: SupportsFloat) None #
Enable on-GPU sigma-G filtering.
- Parameters:
- percentileslist
A length 2 list of percentiles (between 0.0 and 1.0). Example [0.25, 0.75].
- sigmag_coefffloat
The sigma-G coefficient corresponding to the percentiles. This can be computed via SigmaGClipping.find_sigma_g_coeff().
- min_lhfloat
The minimum likelihood for a result to be accepted.
- Raises:
- Raises a
RunTimeError
if invalid values are provided.
- Raises a
- evaluate_single_trajectory(self: kbmod.search.StackSearch, arg0: search::Trajectory, arg1: bool) None #
Performs the evaluation of a single Trajectory object. Modifies the trajectory object in-place to add the statistics.
- Parameters:
- trjkb.Trajectory
The trjactory to evaluate.
- use_kernelbool
Use the kernel code for evaluation. This requires the code is compiled with the nvidia libraries, but performs the exact same computations as on GPU.
Notes
Runs on the CPU.
- get_all_psi_phi_curves(self: kbmod.search.StackSearch, arg0: list[search::Trajectory]) Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'] #
Return a single matrix with both the psi and phi curves. Each row corresponds to a single trajectory and the columns hold the psi values then the phi values (in order of time).
- Parameters:
- trjlist of kb.Trajectory
The input trajectories.
- Returns:
- resultnp.ndarray
A shape (R, 2T) matrix where R is the number of trajectories and T is the number of time steps. The first T columns contain the psi values and the second T columns contain the phi columns.
- get_all_results(self: kbmod.search.StackSearch) list[search::Trajectory] #
Get a reference to the full list of results.
- Returns:
- resultsList
A list of
Trajectory
objects for the cached results.
- get_image_height(self: kbmod.search.StackSearch) int #
Returns the height of the images in pixels.
- get_image_width(self: kbmod.search.StackSearch) int #
Returns the width of the images in pixels.
- get_num_images(self: kbmod.search.StackSearch) int #
Returns the number of images to process.
- get_number_total_results(self: kbmod.search.StackSearch) int #
Get the total number of saved results.
- Returns:
- resultint
The number of saved results.
- get_results(self: kbmod.search.StackSearch, arg0: SupportsInt, arg1: SupportsInt) list[search::Trajectory] #
Get a batch of cached results.
- Parameters:
- startint
The starting index of the results to retrieve. Returns an empty list if start is past the end of the cache.
- countint
The maximum number of results to retrieve. Returns fewer results if there are not enough in the cache.
- Returns:
- resultsList
A list of
Trajectory
objects for the cached results.
- Raises:
RunTimeError
if start < 0 or count <= 0.
- search_all(self: kbmod.search.StackSearch, arg0: list[search::Trajectory], arg1: bool) None #
Perform the KBMOD search by evaluating a list of candidate trajectories at each starting pixel in the image. The results are stored in the
StackSearch
object and can be accessed with get_results().- Parameters:
- search_listlist
A list of Trajectory objects where each trajectory is evaluated at each starting pixel.
- on_gpubool
Run the search on the GPU.
- search_linear_trajectory(self: kbmod.search.StackSearch, arg0: SupportsInt, arg1: SupportsInt, arg2: SupportsFloat, arg3: SupportsFloat, arg4: bool) search::Trajectory #
Performs the evaluation of a linear trajectory in pixel space.
- Parameters:
- xshort
The starting x pixel of the trajectory.
- yshort
The starting y pixel of the trajectory.
- vxfloat
The x velocity of the trajectory in pixels per day.
- vyfloat
The y velocity of the trajectory in pixels per day.
- use_kernelbool
Use the kernel code for evaluation. This requires the code is compiled with the nvidia libraries, but performs the exact same computations as on GPU.
- Returns:
- resultkb.Trajectory
The trajectory object with statistics set.
Notes
Runs on the CPU, but requires CUDA compiler.
- set_min_lh(self: kbmod.search.StackSearch, arg0: SupportsFloat) None #
Sets the minimum likelihood for valid result.
- Parameters:
- new_valuefloat
The minimum likelihood value for a trajectory to be returned.
- set_min_obs(self: kbmod.search.StackSearch, arg0: SupportsInt) None #
Sets the minimum number of observations for valid result.
- Parameters:
- new_valueint
The minimum number of valid observations for a trajectory to be returned.
- set_results(self: kbmod.search.StackSearch, arg0: list[search::Trajectory]) None #
Set the cached results. Used for testing.
- Parameters:
- new_resultsList
The list of results (
Trajectory
objects) to store.
- set_results_per_pixel(self: kbmod.search.StackSearch, arg0: SupportsInt) None #
Set the maximum number of results per pixel returns by a search.
- Parameters:
- new_valueint
The new number of results per pixel.
- Raises:
- Raises a
RunTimeError
if an invalid value is provided (new_value <= 0).
- Raises a
- set_start_bounds_x(self: kbmod.search.StackSearch, arg0: SupportsInt, arg1: SupportsInt) None #
Set the starting and ending bounds in the x direction for a grid search. The grid search will test all pixels [x_min, x_max).
- Parameters:
- x_minint
The inclusive lower bound of the search (in pixels).
- x_maxint
The exclusive upper bound of the search (in pixels).
- Raises:
- Raises a
RunTimeError
if invalid bounds are provided (x_max > x_min).
- Raises a
- set_start_bounds_y(self: kbmod.search.StackSearch, arg0: SupportsInt, arg1: SupportsInt) None #
Set the starting and ending bounds in the y direction for a grid search. The grid search will test all pixels [y_min, y_max).
- Parameters:
- y_minint
The inclusive lower bound of the search (in pixels).
- y_maxint
The exclusive upper bound of the search (in pixels).
- Raises:
- Raises a
RunTimeError
if invalid bounds are provided (x_max > x_min).
- Raises a
- class kbmod.search.StampType#
Bases:
pybind11_object
Members:
STAMP_SUM
STAMP_MEAN
STAMP_MEDIAN
STAMP_VAR_WEIGHTED
- Attributes:
name
name(self: object, /) -> str
- value
- property name#
- class kbmod.search.Trajectory#
Bases:
pybind11_object
A structure for holding basic information about potential results in the form of a linear trajectory in pixel space.
- Attributes:
- xfloat
x coordinate of the trajectory at first time step (in pixels)
- yfloat
y coordinate of the trajectory at first time step (in pixels)
- vxfloat
x component of the velocity, as projected on the image (in pixels per day)
- vyfloat
y component of the velocity, as projected on the image (in pixels per day)
- lhfloat
The computed likelihood of all (valid) points along the trajectory.
- fluxfloat
The computed likelihood of all (valid) points along the trajectory.
- obs_countint
The number of valid points along the trajectory.
Methods
get_x_index
(self, arg0)Returns the predicted x position of the trajectory as an integer (column) index.
get_x_pos
(self, time[, centered])Returns the predicted x position of the trajectory.
get_y_index
(self, arg0)Returns the predicted x position of the trajectory as an integer (row) index.
get_y_pos
(self, time[, centered])Returns the predicted y position of the trajectory.
- get_x_index(self: kbmod.search.Trajectory, arg0: SupportsFloat) int #
Returns the predicted x position of the trajectory as an integer (column) index.
- Parameters:
- timefloat
A zero shifted time in days.
- Returns:
- int
The predicted column index.
- get_x_pos(self: kbmod.search.Trajectory, time: SupportsFloat, centered: bool = True) float #
Returns the predicted x position of the trajectory.
- Parameters:
- timefloat
A zero shifted time in days.
- centeredbool
Shift the prediction to be at the center of the pixel (e.g. xp = x + vx * time + 0.5f). Default = True.
- Returns:
- float
The predicted x position (in pixels).
- get_y_index(self: kbmod.search.Trajectory, arg0: SupportsFloat) int #
Returns the predicted x position of the trajectory as an integer (row) index.
- Parameters:
- timefloat
A zero shifted time in days.
- Returns:
- int
The predicted row index.
- get_y_pos(self: kbmod.search.Trajectory, time: SupportsFloat, centered: bool = True) float #
Returns the predicted y position of the trajectory.
- Parameters:
- timefloat
A zero shifted time in days.
- centeredbool
Shift the prediction to be at the center of the pixel (e.g. xp = x + vx * time + 0.5f). Default = True.
- Returns:
- float
The predicted y position (in pixels).
- class kbmod.search.TrajectoryList#
Bases:
pybind11_object
A list of trajectories that can be transferred between CPU or GPU.
- Attributes:
on_gpu
Whether the data currently resides on the GPU (True) or CPU (False)
Methods
estimate_memory
(self)Estimate the size of the list in bytes.
filter_by_likelihood
(self, arg0)Filter all trajectories with a likelihood above the given threshold.
filter_by_obs_count
(self, arg0)Filter all trajectories with an obs_count above the given threshold.
get_batch
(self, arg0, arg1)Return a batch of results.
get_list
(self)Return the full list of trajectories.
get_memory
(self)Return the size of the list in bytes.
get_size
(self)Return the size of the list in number of elements.
get_trajectory
(self, arg0)Get a reference trajectory from the list.
move_to_cpu
(self)Move the data from GPU to CPU.
move_to_gpu
(self)Move the data from CPU to GPU.
resize
(self, arg0)Forcibly resize the array.
set_trajectories
(self, arg0)Set an entire list of trajectories.
set_trajectory
(self, arg0, arg1)Set a trajectory in the list.
sort_by_likelihood
(self)Sort the data in order of decreasing likelihood.
- estimate_memory(self: SupportsInt) int #
Estimate the size of the list in bytes.
- Parameters:
- num_elementsint
The number of elements that will be in the list.
- Returns:
- sizeint
The number of bytes needed for the list on CPU and GPU.
- filter_by_likelihood(self: kbmod.search.TrajectoryList, arg0: SupportsFloat) None #
Filter all trajectories with a likelihood above the given threshold. Changes the order of the data and the size of the list. The data must reside on the CPU.
- Parameters:
- min_lhfloat
The minimum likelihood.
- Raises:
- Raises a
RuntimeError
the data is on GPU.
- Raises a
- filter_by_obs_count(self: kbmod.search.TrajectoryList, arg0: SupportsInt) None #
Filter all trajectories with an obs_count above the given threshold. Changes the order of the data and the size of the list. The data must reside on the CPU.
- Parameters:
- min_obs_countint
The minimum obs_count.
- Raises:
- Raises a
RuntimeError
the data is on GPU.
- Raises a
- get_batch(self: kbmod.search.TrajectoryList, arg0: SupportsInt, arg1: SupportsInt) list[kbmod.search.Trajectory] #
Return a batch of results. The data must reside on the CPU.
- Parameters:
- startint
The starting index of the results to retrieve. Returns an empty list if start is past the end of the cache.
- countint
The maximum number of results to retrieve. Returns fewer results if there are not enough in the cache.
- Returns:
- resultsList
A list of
Trajectory
objects for the cached results.
- Raises:
RunTimeError
if start < 0 or count <= 0 or if the data is on GPU.
- get_list(self: kbmod.search.TrajectoryList) list[kbmod.search.Trajectory] #
Return the full list of trajectories. The data must reside on the CPU.
- Returns:
- resultlist
The list of trajectories
- Raises:
- Raises a
RuntimeError
if the data currently resides on the GPU.
- Raises a
- get_memory(self: kbmod.search.TrajectoryList) int #
Return the size of the list in bytes.
- get_size(self: kbmod.search.TrajectoryList) int #
Return the size of the list in number of elements.
- get_trajectory(self: kbmod.search.TrajectoryList, arg0: SupportsInt) kbmod.search.Trajectory #
Get a reference trajectory from the list. The data must reside on the CPU.
- Parameters:
- indexint
The index of the entry.
- Returns:
- trjTrajectory
The corresponding Trajectory object.
- Raises:
- Raises a
RuntimeError
if the index is invalid or the data currently resides - on the GPU.
- Raises a
- move_to_cpu(self: kbmod.search.TrajectoryList) None #
Move the data from GPU to CPU. If the data is already on the CPU this is a no-op.
- Raises:
- Raises a
RuntimeError
if invalid state encountered.
- Raises a
- move_to_gpu(self: kbmod.search.TrajectoryList) None #
Move the data from CPU to GPU. If the data is already on the GPU this is a no-op.
- Raises:
- Raises a
RuntimeError
if invalid state encountered.
- Raises a
- property on_gpu#
Whether the data currently resides on the GPU (True) or CPU (False)
- resize(self: kbmod.search.TrajectoryList, arg0: SupportsInt) None #
Forcibly resize the array. If the size is decreased, the extra entries are dropped from the back. If the size is increased, extra (blank) trajectories are added to the back.
The data must reside on the CPU.
- Parameters:
- new_sizeint
The new size of the list.
- Raises:
RunTimeError
if new_size < 0 or data is on GPU.
- set_trajectories(self: kbmod.search.TrajectoryList, arg0: list[kbmod.search.Trajectory]) None #
Set an entire list of trajectories. Resizes the array to match the given input. The data must reside on the CPU.
- Parameters:
- new_valueslist
A list of Trajectory objects.
- Raises:
- Raises a
RuntimeError
if the index is invalid or the data currently resides - on the GPU.
- Raises a
- set_trajectory(self: kbmod.search.TrajectoryList, arg0: SupportsInt, arg1: kbmod.search.Trajectory) None #
Set a trajectory in the list. The data must reside on the CPU.
- Parameters:
- indexint
The index of the entry.
- new_valueTrajectory
The corresponding Trajectory object.
- Raises:
- Raises a
RuntimeError
if the index is invalid or the data currently resides - on the GPU.
- Raises a
- sort_by_likelihood(self: kbmod.search.TrajectoryList) None #
Sort the data in order of decreasing likelihood. The data must reside on the CPU.
- Raises:
- Raises a
RuntimeError
the data is on GPU.
- Raises a
- kbmod.search.compute_scale_params_from_image_vect(arg0: list[Annotated[numpy.typing.ArrayLike, numpy.float32, '[m, n]']], arg1: SupportsInt) Annotated[list[float], FixedSize(3)] #
- kbmod.search.convolve_image(image: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'], psf: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]']) Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'] #
Convolves the image (in place) with a PSF using a CPU if one is available and a GPU otherwise.
- Parameters:
- imagenumpy.ndarray
The image data as a two dimensional array.
- psfnumpy.ndarray
The kernel of the Point Spread Function as a two dimensional array.
- Returns:
- resultnumpy.ndarray
The resulting image.
- kbmod.search.convolve_image_cpu(image: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'], psf: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]']) Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'] #
Convolve the image with a PSF on the CPU.
- Parameters:
- imagenumpy.ndarray
The image data as a two dimensional array.
- psfnumpy.ndarray
The kernel of the Point Spread Function as a two dimensional array.
- Returns:
- resultnumpy.ndarray
The resulting image.
- kbmod.search.convolve_image_gpu(image: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'], psf: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]']) Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'] #
Convolve the image with a PSF on the GPU.
- Parameters:
- imagenumpy.ndarray
The image data as a two dimensional array.
- psfnumpy.ndarray
The kernel of the Point Spread Function as a two dimensional array.
- Returns:
- resultnumpy.ndarray
The resulting image.
- kbmod.search.decode_uint_scalar(arg0: SupportsFloat, arg1: SupportsFloat, arg2: SupportsFloat) float #
- kbmod.search.encode_uint_scalar(arg0: SupportsFloat, arg1: SupportsFloat, arg2: SupportsFloat, arg3: SupportsFloat) float #
- kbmod.search.evaluate_trajectory_cpu(arg0: search::PsiPhiArray, arg1: search::Trajectory) None #
- kbmod.search.extract_all_trajectory_flux(arg0: list[kbmod.search.Trajectory]) list[float] #
Extract all the flux values from a list of trajectories.
- Parameters:
- trjslist of Trajectory
The trajectories to process.
- Returns:
- resultslist of float
The flux values for each trajectory in the list.
- kbmod.search.extract_all_trajectory_lh(arg0: list[kbmod.search.Trajectory]) list[float] #
Extract all the likelihood values from a list of trajectories.
- Parameters:
- trjslist of Trajectory
The trajectories to process.
- Returns:
- resultslist of float
The likelihood values for each trajectory in the list.
- kbmod.search.extract_all_trajectory_obs_count(arg0: list[kbmod.search.Trajectory]) list[int] #
Extract all the vy values from a list of trajectories.
- Parameters:
- trjslist of Trajectory
The trajectories to process.
- Returns:
- resultslist of int
The obs_count values for each trajectory in the list.
- kbmod.search.extract_all_trajectory_vx(arg0: list[kbmod.search.Trajectory]) list[float] #
Extract all the vx values from a list of trajectories.
- Parameters:
- trjslist of Trajectory
The trajectories to process.
- Returns:
- resultslist of float
The vx values for each trajectory in the list.
- kbmod.search.extract_all_trajectory_vy(arg0: list[kbmod.search.Trajectory]) list[float] #
Extract all the vy values from a list of trajectories.
- Parameters:
- trjslist of Trajectory
The trajectories to process.
- Returns:
- resultslist of float
The vy values for each trajectory in the list.
- kbmod.search.extract_all_trajectory_x(arg0: list[kbmod.search.Trajectory]) list[int] #
Extract all the x values from a list of trajectories.
- Parameters:
- trjslist of Trajectory
The trajectories to process.
- Returns:
- resultslist of int
The x values for each trajectory in the list.
- kbmod.search.extract_all_trajectory_y(arg0: list[kbmod.search.Trajectory]) list[int] #
Extract all the y values from a list of trajectories.
- Parameters:
- trjslist of Trajectory
The trajectories to process.
- Returns:
- resultslist of int
The y values for each trajectory in the list.
- kbmod.search.fill_psi_phi_array(arg0: kbmod.search.PsiPhiArray, arg1: SupportsInt, arg2: list[Annotated[numpy.typing.ArrayLike, numpy.float32, '[m, n]']], arg3: list[Annotated[numpy.typing.ArrayLike, numpy.float32, '[m, n]']], arg4: list[SupportsFloat]) None #
Fill the PsiPhiArray from Psi and Phi images.
- Parameters:
- result_dataPsiPhiArray
The location to store the data.
- num_bytesint
The type of encoding to use (1, 2, or 4).
- psi_imgslist
A list of psi images as numpy arrays.
- phi_imgslist
A list of phi images as numpy arrays.
- zeroed_timeslist
A list of floating point times starting at zero.
- Raises:
- Raises a RuntimeError if invalid values are found in the psi or phi arrays.
- kbmod.search.fill_psi_phi_array_from_image_arrays(arg0: kbmod.search.PsiPhiArray, arg1: SupportsInt, arg2: list[Annotated[numpy.typing.ArrayLike, numpy.float32, '[m, n]']], arg3: list[Annotated[numpy.typing.ArrayLike, numpy.float32, '[m, n]']], arg4: list[Annotated[numpy.typing.ArrayLike, numpy.float32, '[m, n]']], arg5: list[SupportsFloat]) None #
Fill the PsiPhiArray from arrays of the image data.
- Parameters:
- result_dataPsiPhiArray
The location to store the data.
- num_bytesint
The type of encoding to use (1, 2, or 4).
- sci_imgslist
A list of science images as numpy arrays.
- var_imgslist
A list of variance images as numpy arrays.
- psf_kernelslist
A list of PSF kernels as numpy arrays.
- zeroed_timeslist
A list of floating point times starting at zero.
- Raises:
- Raises a RuntimeError if invalid values are found.
- kbmod.search.generate_phi(var: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'], psf: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]']) Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'] #
Generates the full psi image where the value of each pixel p in the resulting image is 1.0 / variance[p], skipping masked pixels.
Convolves the resulting image with the square of the PSF.
- Parameters:
- varnumpy.ndarray
The variance data as a H x W dimensional array.
- psfnumpy.ndarray
The kernel of the Point Spread Function as a two dimensional array.
- Returns:
- resultnumpy.ndarray
A numpy array the same shape as the input image.
- kbmod.search.generate_psi(sci: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'], var: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'], psf: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]']) Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'] #
Generates the full psi image where the value of each pixel p in the resulting image is science[p] / variance[p], skipping masked pixels. Convolves the resulting image with the PSF.
- Parameters:
- scinumpy.ndarray
The science data as a H x W dimensional array.
- varnumpy.ndarray
The variance data as a H x W dimensional array.
- psfnumpy.ndarray
The kernel of the Point Spread Function as a two dimensional array.
- Returns:
- resultnumpy.ndarray
A numpy array the same shape as the input image.
- kbmod.search.get_gpu_free_memory() int #
Return the GPUs free memory in bytes.
- kbmod.search.get_gpu_total_memory() int #
Return the GPUs total memory in bytes.
- kbmod.search.kb_has_gpu() bool #
Check if GPU is available
- kbmod.search.pixel_value_valid(arg0: SupportsFloat) bool #
- kbmod.search.print_cuda_stats() None #
Display the basic GPU information to standard out.
- kbmod.search.search_cpu_only(arg0: search::PsiPhiArray, arg1: search::SearchParameters, arg2: search::TrajectoryList, arg3: search::TrajectoryList) None #
- kbmod.search.sigmag_filtered_indices(arg0: list[SupportsFloat], arg1: SupportsFloat, arg2: SupportsFloat, arg3: SupportsFloat, arg4: SupportsFloat) list[int] #
- kbmod.search.square_psf_values(given_psf: Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]']) Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]'] #
Compute the (unnormalized) square of a psf. This squares each value in the PSF kernel.
- Parameters:
- given_psfnumpy.ndarray
The kernel of the Point Spread Function as a two dimensional array.
- Returns:
- resultnumpy.ndarray
The resulting kernel.
- kbmod.search.stat_gpu_memory_mb() str #
Create a minimal GPU stats string for debugging.
- kbmod.search.validate_gpu(req_memory: SupportsInt = 0) bool #
Check that a GPU is present, accessible, and has sufficient memory.
- Parameters:
- req_memoryint
The minimum free memory in bytes. Default: 0
- Returns:
- bool
Indicates whether the GPU is valid.