Module: result_list#
- class kbmod.result_list.ResultList(all_times, track_filtered=False)[source]#
This class stores a collection of related data from all of the kbmod results.
Methods
append_result
(res)Add a single ResultRow to the result set.
append_result_dict
(res_dict)Append all the results in a dictionary (as defined by gen_results_dict) to the current result list.
apply_filter
(filter_obj[, num_threads])Apply the given filter object to the ResultList.
clear
()Clear the list of results.
extend
(result_list)Append the results in a second ResultSet to the current one.
filter_results
(indices_to_keep[, label])Filter the rows in the ResultList to only include those indices in the list indices_to_keep.
get_filtered
([label])Get the results filtered at a given stage or all stages.
Return the number of results in the list.
save_to_files
(res_filepath, out_suffix)This function saves results from a search method to a series of files.
Transform the ResultsSet into a dictionary as defined by gen_results_dict.
Create and return a list of tuples for each psi/phi curve.
- append_result(res)[source]#
Add a single ResultRow to the result set.
- Parameters:
- resResultRow
The new result to add.
- append_result_dict(res_dict)[source]#
Append all the results in a dictionary (as defined by gen_results_dict) to the current result list. Used for backwards compatibility.
- Parameters:
- res_dictdict
A dictionary of results as defined by gen_results_dict.
- apply_filter(filter_obj, num_threads=1)[source]#
Apply the given filter object to the ResultList.
Modifies the ResultList in place.
- Parameters:
- filter_objFilter
The filtering object to use.
- Returns:
- selfResultList
Returns a reference to itself to allow chaining.
- extend(result_list)[source]#
Append the results in a second ResultSet to the current one.
- Parameters:
- result_listResultList
The data structure containing additional ResultRow elements to add.
- filter_results(indices_to_keep, label=None)[source]#
Filter the rows in the ResultList to only include those indices in the list indices_to_keep.
- Parameters:
- indices_to_keeplist
The indices of the rows to keep.
- labelstring
The label of the filtering stage to use. Only used if we keep filtered trajectories.
- Returns:
- selfResultList
Returns a reference to itself to allow chaining.
- get_filtered(label=None)[source]#
Get the results filtered at a given stage or all stages.
- Parameters:
- labelstr
The filtering stage to use. If no label is provided, return all filtered rows.
- Returns:
- resultslist
A list of all filtered rows.
- num_results()[source]#
Return the number of results in the list.
- Returns:
- int
The number of results in the list.
- save_to_files(res_filepath, out_suffix)[source]#
This function saves results from a search method to a series of files.
- Parameters:
- res_filepathstring
The directory in which to store the results.
- out_suffixstring
The suffix to append to the output file name
- class kbmod.result_list.ResultRow(trj, num_times)[source]#
This class stores a collection of related data from a single kbmod result.
- Attributes:
- all_stamps
- final_likelihood
light_curve
Compute the light curve from the psi and phi curves.
likelihood_curve
Compute the likelihood curve for each point (based on psi and phi).
- num_times
- phi_curve
- psi_curve
- stamp
- trajectory
- valid_indices
Methods
filter_indices
(indices_to_keep)Remove invalid indices and times from the ResultRow.
set_psi_phi
(psi, phi)Set the psi and phi curves and auto calculate the light curve.
Get a Boolean vector indicating which indices are valid.
valid_times
(all_times)Get the times for the indices marked as valid.
- filter_indices(indices_to_keep)[source]#
Remove invalid indices and times from the ResultRow. This uses relative filtering where valid_indices[i] is kept for all i in indices_to_keep. Updates the trajectory’s likelihood using only the new valid indices.
- Parameters:
- indices_to_keeplist
A list of which of the current indices to keep.
- Raises:
- ValueError: If any of the given indices are out of bounds.
- property light_curve#
Compute the light curve from the psi and phi curves.
- Returns:
- lclist
The likelihood curve. This is an empty list if either psi or phi are not set.
- property likelihood_curve#
Compute the likelihood curve for each point (based on psi and phi).
- Returns:
- lhlist
The likelihood curve. This is an empty list if either psi or phi are not set.
- set_psi_phi(psi, phi)[source]#
Set the psi and phi curves and auto calculate the light curve.
- Parameters:
- psilist
The psi curve.
- philist
The phi curve.
- Raises:
- ValueError
If the phi and psi lists are not the same length as the number of times.
This class manages tools that are shared by the classes Interface and PostProcess.
Notes
Legacy approach. Soon to be deprecated.
Methods
Return an empty results dictionary.
Return an empty results dictionary. All values needed for a results dictionary should be added here. This dictionary gets passed into and out of most Interface and PostProcess methods, getting altered and/or replaced by filtering along the way.
- Returns:
- keepdict
The result dictionary.
- kbmod.result_list.load_result_list_from_files(res_filepath, suffix, all_mjd=None)[source]#
Create a new ResultList from outputted files.
- Parameters:
- res_filepathstring
The directory in which the results are stored.
- suffixstring
The suffix appended to the output file names.
- all_mjdlist
A list of all the MJD timestamps (optional). If not provided, the function loads from the all_times file.
- Returns:
- resultsResultList
The results stored in the given directory with the correct suffix.