h0rton.tdlmc_utils package

h0rton.tdlmc_utils.reorder_images module

h0rton.tdlmc_utils.reorder_images.reorder_to_tdlmc(abcd_ordering_i, ra_img, dec_img, time_delays)[source]

Reorder the list of ra, dec, and time delays to conform to the order in the TDLMC challenge

abcd_ordering_i : array-like
ABCD in an increasing dec order if the keys ABCD mapped to values 0123, respectively, e.g. [3, 1, 0, 2] if D (value 3) is lowest, B (value 1) is second lowest
ra_img : array-like
list of ra from lenstronomy
dec_img : array-like
list of dec from lenstronomy, in the order specified by ra_img
time_delays : array-like
list of time delays from lenstronomy, in the order specified by ra_img
tuple
tuple of (reordered ra, reordered_dec, reordered time delays)

h0rton.tdlmc_utils.tdlmc_parser module

h0rton.tdlmc_utils.tdlmc_parser.convert_to_dataframe(rung, save_csv_path)[source]

Store the TDLMC closed and open boxes into a Pandas DataFrame and exports to a csv file at the same location

rung : int
rung number
save_csv_path : str
path of the csv file to be generated
Pandas DataFrame
the extracted rung data
h0rton.tdlmc_utils.tdlmc_parser.parse_closed_box(closed_box_path, row_dict={})[source]

Parse the lines of an open-box TDLMX text file for Rungs 0, 1, and 2

closed_box_path : str
path to the closed box text file, lens_info_for_Good_team.txt.txt
row_dict : dict
dictionary of the row info to update. Default: dict()
dict
An updated dictionary containing the information in the closed box text file
h0rton.tdlmc_utils.tdlmc_parser.parse_open_box(open_box_path, row_dict={})[source]

Parse the lines of an open-box TDLMX text file for Rungs 0, 1, and 2

open_box_path : str
path to the open box text file, lens_all_info.txt
row_dict : dict
dictionary of the row info to update. Default: dict()
dict
An updated dictionary containing the information in the open box text file
h0rton.tdlmc_utils.tdlmc_parser.read_from_csv(csv_path)[source]

Read a Pandas Dataframe from the combined csv file of TDLMC data while evaluating all the relevant strings in each column as Python objects

csv_path : str
path to the csv file generated using convert_to_dataframe
Pandas DataFrame
the TDLMC data with correct Python objects
h0rton.tdlmc_utils.tdlmc_parser.format_results_for_tdlmc_metrics(version_dir, out_dir, rung_id=2)[source]

Format the BNN inference results so they can be read into the script that generates the TDLMC metrics cornerplot

version_dir : str or os.path object
path to the folder containing inference results
rung_id : int
TDLMC rung ID