The Modules

TelescopeML.DataMaster Module

class TelescopeML.DataMaster.DataProcessor(flux_values: ndarray | None = None, wavelength_names: List[str] | None = None, wavelength_values: ndarray | None = None, output_values: ndarray | None = None, output_names: str | None = None, spectral_resolution: None | int = None, trained_ML_model: None | sklearn.base.BaseEstimator = None, trained_ML_model_name: None | str = None, ml_method: str = 'regression')

Bases: object

Perform various tasks to process the datasets, including:

  • Prepare inputs and outputs

  • Split the dataset into training, validation, and test sets

  • Scale/normalize the data

  • Visualize the data

  • Conduct feature engineering

Parameters:
  • flux_values (np.ndarray) – Flux arrays (input data).

  • wavelength_names (List[str]) – Name of wavelength in micron.

  • wavelength_values (np.ndarray) – wavelength array in micron.

  • output_values (np.ndarray) – output variable array (e.g., Temperature, Gravity, Carbon_to_Oxygen, Metallicity).

  • output_names (List[str]) – Name of the output variable.

  • spectral_resolution (int, optional) – Resolution of the synthetic spectra used to generate the dataset.

  • trained_ML_model (BaseEstimator, optional) – ML model object from sklearn package.

  • trained_ML_model_name (str, optional) – Name of the ML model.

  • ml_method (str, optional) – Machine learning method (‘regression’ or ‘classification’).

normalize_X_column_wise(output_indicator='Trained_Normalizer_X_ColWise', X_train=None, X_val=None, X_test=None, print_model=False)

Normalize features/column variables to a specified range [0, 1].

Parameters:
  • X_train (array) – Training feature matrix.

  • X_val (array) – Validation feature matrix.

  • X_test (array) – Test feature matrix.

  • print_model (bool, optional) – Whether to print the trained normalizer model.

Returns:

  • self.X_train_normalized_columnwise (array) – Normalized training feature matrix.

  • self.X_val_normalized_columnwise (array) – Normalized validation feature matrix.

  • self.X_test_normalized_columnwise (array) – Normalized test feature matrix.

  • self.normalize_X_ColumnWise (MinMaxScaler) – Trained normalizer object.

normalize_X_row_wise(output_indicator='Trained_Normalizer_X_RowWise', X_train=None, X_val=None, X_test=None, print_model=False)

Normalize observations/instances/row variables to a specified range [0, 1].

Transform your data such that its values are within the specified range [0, 1].

Parameters:
  • X_train (array) – Training feature matrix.

  • X_val (array) – Validation feature matrix.

  • X_test (array) – Test feature matrix.

  • print_model (bool, optional) – Whether to print the trained normalizer model.

Returns:

  • self.X_train_normalized_rowwise (array) – Normalized training feature matrix.

  • self.X_val_normalized_rowwise (array) – Normalized validation feature matrix.

  • self.X_test_normalized_rowwise (array) – Normalized test feature matrix.

normalize_y_column_wise(output_indicator='Trained_Normalizer_y_ColWise', y_train=None, y_val=None, y_test=None, print_model=False)

Scale target variable (y) and column-wise feature variables to a specified range. Transform the data such that its values are within the specified range [0, 1].

Parameters:
  • y_train (array) – Training target variable array.

  • y_val (array) – Validation target variable array.

  • y_test (array) – Test target variable array.

  • print_model (bool) – Whether to print the trained scaler model.

Returns:

  • self.y_train_normalized_columnwise (array) – Scaled training target variable array.

  • self.y_val_normalized_columnwise (array) – Scaled validation target variable array.

  • self.y_test_normalized_columnwise (array) – Scaled test target variable array.

plot_boxplot_scaled_features(scaled_feature, title=None, xticks_list=None, fig_size=(14, 3))

Make a boxplot with the scaled features.

Description

  • Median: middle quartile marks.

  • Inter-quartile range (The middle “box”): 50% of scores fall within the inter-quartile range.

  • Upper quartile: 75% of the scores fall below the upper quartile.

  • Lower quartile: 25% of scores fall below the lower quartile.

plot_histogram_scaled_features(scaled_feature)

Plotting the histogram of scaled features

split_train_test(test_size=0.1)

Split the loaded dataset into train and test sets

Parameters:

test_size (float) – The proportion of the dataset to include in the test split (default = 0.1).

Returns:

  • self.X_train (array) – X train set.

  • self.X_test (array) – X test set.

  • self.y_train (array) – y train set.

  • self.y_test (array) – y test set.

References

link: sklearn.model_selection.train_test_split

split_train_validation_test(test_size=0.1, val_size=0.1, random_state_=42)

Split the loaded dataset into train, validation, and test sets.

Parameters:
  • test_size (float) – Proportion of the dataset to include in the test split (default = 0.1).

  • val_size (float) – Proportion of the remaining train dataset to include in the validation split (default = 0.1).

Returns:

  • self.X_train (array) – Used to train the machine learning model.

  • self.X_val (array) – Used to validate the machine learning model.

  • self.X_test (array) – Used to evaluate the machine learning model.

  • self.y_train (array) – Outputs used for training the models.

  • self.y_val (array) – Outputs used for validating the models.

  • self.y_test (array) – Outputs used for testing the models.

References

link: sklearn.model_selection.train_test_split

standardize_X_column_wise(output_indicator='Trained_StandardScaler_X_ColWise', X_train=None, X_val=None, X_test=None, print_model=False)

Standardize feature variables (X) column-wise by removing the mean and scaling to unit variance. Transform the data such that each feature will have a mean value of 0 and a standard deviation of 1.

Parameters:
  • X_train (array) – Training feature matrix.

  • X_val (array) – Validation feature matrix.

  • X_test (array) – Test feature matrix.

  • print_model (bool) – Whether to print the trained scaler model.

Returns:

  • self.X_train_standardized_columnwise (array) – Standardized training feature matrix.

  • self.X_val_standardized_columnwise (array) – Standardized validation feature matrix.

  • self.X_test_standardized_columnwise (array) – Standardized test feature matrix.

standardize_X_row_wise(output_indicator='Trained_StandardScaler_X_RowWise', X_train=None, X_val=None, X_test=None, print_model=False)

Standardize feature variables (X) column-wise by removing the mean and scaling to unit variance. Transform the data such that each feature will have a mean value of 0 and a standard deviation of 1.

Parameters:
  • X_train (array) – Training feature matrix.

  • X_val (array) – Validation feature matrix.

  • X_test (array) – Test feature matrix.

  • print_model (bool) – Whether to print the trained scaler model.

Returns:

  • self.X_train_standardized_columnwise (array) – Standardized training feature matrix.

  • self.X_val_standardized_columnwise (array) – Standardized validation feature matrix.

  • self.X_test_standardized_columnwise (array) – Standardized test feature matrix.

standardize_y_column_wise(output_indicator='Trained_StandardScaler_y_ColWise', y_train=None, y_val=None, y_test=None, print_model=False)

Standardize target variable (y) column-wise by removing the mean and scaling to unit variance. Transform the data such that its distribution will have a mean value of 0 and a standard deviation of 1.

Parameters:
  • y_train (array) – Training target variable array.

  • y_val (array) – Validation target variable array.

  • y_test (array) – Test target variable array.

  • print_model (bool) – Whether to print the trained scaler model.

Returns:

  • self.y_train_standardized_columnwise (array) – Standardized training target variable array.

  • self.y_val_standardized_columnwise (array) – Standardized validation target variable array.

  • self.y_test_standardized_columnwise (array) – Standardized test target variable array.

TelescopeML.DeepTrainer Module

class TelescopeML.DeepTrainer.TrainRegressorCNN(X1_train, X1_val, X1_test, X2_train, X2_val, X2_test, y1_train, y1_val, y1_test, y2_train, y2_val, y2_test, y3_train, y3_val, y3_test, y4_train, y4_val, y4_test)

Bases: object

Train Convolutional Neural Networks model using regression approach

Parameters:
  • X1_train (array) – Row-StandardScaled input spectra for training.

  • X1_val (array) – Row-StandardScaled input spectra for validation.

  • X1_test (array) – Row-StandardScaled input spectra for testing.

  • X2_train (array) – Col-StandardScaled Mix Max of all rows of input spectra for training.

  • X2_val (array) – Col-StandardScaled Mix Max of all rows of input spectra for validation.

  • X2_test (array) – Col-StandardScaled Mix Max of all rows of input spectra for testing.

  • y1_train (array) – Col-StandardScaled target feature 1 for training.

  • y1_val (array) – Col-StandardScaled target feature 1 for validation.

  • y1_test (array) – Col-StandardScaled target feature 1 for testing.

  • y2_train (array) – Col-StandardScaled target feature 2 for training.

  • y2_val (array) – Col-StandardScaled target feature 2 for validation.

  • y2_test (array) – Col-StandardScaled target feature 2 for testing.

  • y3_train (array) – Col-StandardScaled target feature 3 for training.

  • y3_val (array) – Col-StandardScaled target feature 3 for validation.

  • y3_test (array) – Col-StandardScaled target feature 3 for testing.

  • y4_train (array) – Col-StandardScaled target feature 4 for training.

  • y4_val (array) – Col-StandardScaled target feature 4 for validation.

  • y4_test (array) – Col-StandardScaled target feature 4 for testing.

build_model(config)

Build a CNN model with the given hyperparameters.

Parameters:

hyperparameters (dict) –

A dictionary containing hyperparameter settings.

hyperparameters keys includes:
  • ’Conv__num_blocks’ (int): Number of blocks in the CNN model.

  • ’Conv__num_layers_per_block’ (int): Number of layers in each convolutional block.

  • ’Conv__num_filters’ (list): Number of filters in each layer.

  • ’Conv__kernel_size’ (int): Size of the convolutional kernel.

  • ’Conv__MaxPooling1D’ (bool): MaxPooling1D size.

  • ’FC1__num_blocks’ (int): Number of blocks in the first fully connected (FC1) part.

  • ’FC1_num_layers_per_block’ (int): Number of layers in each FC1 block.

  • ’FC1__units’ (list): Number of units in each FC1 layer.

  • ’FC1__dropout’ (float): Dropout rate for FC1 layers.

  • ’FC2__num_blocks’ (int): Number of blocks in the second fully connected (FC2) part.

  • ’FC2_num_layers_per_block’ (int): Number of layers in each FC2 block.

  • ’FC2__units’ (list): Number of units in each FC2 layer.

  • ’FC2__dropout’ (float): Dropout rate for FC2 layers.

  • ’learning_rate’ (float): Learning rate for the model.

Example

>>> hyperparameters = {
>>>      'Conv__MaxPooling1D': 2,
>>>      'Conv__num_blocks': 1,
>>>      'Conv__num_layers_per_block': 3,
>>>      'Conv__num_filters': 4,
>>>      'Conv__kernel_size': 6,
>>>      'FC__NumberLayers': 4,
>>>      'FC1__num_blocks' : 1,
>>>      'FC1_num_layers_per_block': 4,
>>>      'FC1__dropout': 0.09889223768186726,
>>>      'FC1__units': 128,
>>>      'FC2__num_blocks' : 1,
>>>      'FC2_num_layers_per_block':2,
>>>      'FC2__dropout': 0.0024609140719442646,
>>>      'FC2__units': 64,
>>>      'learning_rate': 4.9946842008422193e-05}
Returns:

Pre-build tf.keras.Model CNN model.

Return type:

object

fit_cnn_model(batch_size=32, budget=3)

Fit the pre-build CNN model

Returns:

Training history (Loss values for train) Trained model

TelescopeML.Predictor Module

class TelescopeML.Predictor.ObserveParameterPredictor(object_name, training_dataset_df, wl_synthetic, bd_literature_dic, trained_ML_model, trained_X_ColWise_MinMax=None, trained_y_ColWise=None, trained_X_RowWise=None)

Bases: object

Load, process, and visualize observational spectra.

Parameters:
  • F_lambda_obs (array) – Fluxes for each feature (wavelength) from observational data.

  • F_lambda_obs_err (array) – Observed spectra error bars.

  • wl_obs (array) – Name of features (wavelength) from observational data, e.g., 0.9, 1.0, 1.1 micron.

  • wl_synthetic (array) – Name of features (wavelengths) from synthetic data.

Example

>>> HD3651B_BD_literature_info = {
>>>   'bd_name':'HD3651B',
>>>   'bd_Teff':818,
>>>   'bd_logg':3.94,
>>>   'bd_met': -0.22,
>>>   'bd_distance_pc' : 11.134,
>>>   'bd_radius_Rjup' : 0.81,
>>>   'bd_radius_Rjup_tuned': .81}
Flam_to_Fnu(Flam_values, Flam_errors, wavelengths)

Convert F_lambda to F_nu along with error propagation. :param Flam_values: :param Flam_errors: :param wavelengths:

Returns:

  • fnu_values (array) – Array of flux density values in F_nu.

  • fnu_errors (array) – Array of error bars for the flux density values in F_nu.

Fnu_to_Fnu_abs(Fnu_values, Fnu_errors, bd_literature_dic=None, __plot__=False)
ProcessObservationalDataset(F_lambda_obs, F_lambda_obs_err, wl_obs, bd_literature_dic=None)

Process the observational dataset and set various attributes of the object.

Parameters:
  • F_lambda_obs (array) – Observed feature values.

  • F_lambda_obs_err (array) – Errors corresponding to the observed feature values.

  • wl_obs (array) – Names of the observed features.

  • wl_synthetic (array) – Names of the synthetic features.

  • bd_literature_dic (dict, optional) – Dictionary containing literature information. Defaults to None.

Return type:

Fnu_obs , Fnu_obs_err, Fnu_obs_TOA, Fnu_obs_TOA_err

Example

>>> HD3651B_BD_literature_info = {'bd_name':'HD3651B',
>>>   'bd_Teff':818,
>>>   'bd_logg':3.94,
>>>   'bd_met': -0.22,
>>>   'bd_distance_pc' : 11.134,
>>>   'bd_radius_Rjup' : 0.81,
>>>   'bd_radius_Rjup_tuned': .81}
Process_Observational_Dataset(__print_results__=False, F_lambda_obs=None, F_lambda_obs_err=None)

Process the observational dataset, extract ML features, perform predictions, and optionally print the results and plot the predicted versus observed spectra.

Parameters:

__print_results__ (bool) – True or False.

flux_interpolated(Fnu_obs_TOA, interpolated_wl=None, __print_results__=False, __plot_spectra_errorbar__=False, __use_spectres__=True)

Perform flux interpolation using either SpectRes or pchip interpolation.

Parameters:
  • __print_results__ (bool) – True or False.

  • __plot_spectra_errorbar__ (bool) – True or False.

  • __use_spectres__ (bool, optional) – Whether to use SpectRes for interpolation. Defaults to True.

Return type:

Fnu_obs_TOA_intd, Fnu_obs_TOA_intd_df

load_observational_spectra(obs_data_df=None, __plot_observational_spectra_errorbar__=False, __replace_zeros_negatives_with_mean__=True, __print_results__=False)

Load the observational spectra, process the dataset, and optionally plot the observational spectra with error bars.

Parameters:
  • __plot_observational_spectra_errorbar__ (bool) – True or False.

  • __replace_zeros_negatives_with_mean__ (bool) – True or False.

  • __print_results__ (bool) – True or False.

predict_from_random_spectra(random_spectra_num=10, __print_results__=False, __plot_randomly_generated_spectra__=False, __plot_histogram__=False, __plot_boxplot_hist__=False, __plot_pred_vs_obs_errorbar__=False, __plot_pred_vs_obs_errorbar_stat_bokeh__=False, __plot_pred_vs_obs_errorbar_stat_matplotlib__=False, __calculate_confidence_intervals_std_df__=False)

Generate random spectra based on the observational data, predict the target features, and plot the spectra

Parameters:
  • random_spectra_num (int, optional) – Number of random spectra to generate. Defaults to 10.

  • __print_results__ (bool) – True or False.

  • __plot_randomly_generated_spectra__ (bool) – True or False.

  • __plot_histogram__ (bool) – True or False.

  • __plot_boxplot_hist__ (bool) – True or False.

  • __plot_pred_vs_obs_errorbar__ (bool) – True or False.

  • __plot_pred_vs_obs_errorbar_stat_bokeh__ (bool) – True or False.

  • __calculate_confidence_intervals_std_df__ (bool) – True or False.

TelescopeML.StatVisAnalyzer Module

TelescopeML.StatVisAnalyzer.calculate_confidence_intervals_std_df(dataset_df, __print_results__=False, __plot_calculate_confidence_intervals_std_df__=False)

Calculate confidence intervals and other statistics for a DataFrame.

Parameters:
  • dataset_df (DataFrame) – The input DataFrame containing the data.

  • __print_results__ (bool) – True or False.

  • __plot_calculate_confidence_intervals_std_df__ (bool) – True or False.

Returns:

A DataFrame with the calculated statistics.

Return type:

DataFrame

TelescopeML.StatVisAnalyzer.chi_square_test(x_obs, y_obs, yerr_obs, x_pre, y_pre, yerr_pre, radius, __plot_results__=False, __print_results__=True)

Perform the chi-square test to evaluate the similarity between two datasets with error bars.

Parameters:
  • x_obs (array) – The x-coordinates of the observed dataset.

  • y_obs (array) – The y-coordinates of the observed dataset.

  • yerr_obs (array) – The error bars associated with the observed dataset.

  • x_pre (array) – The x-coordinates of the predicted dataset.

  • y_pre (array) – The y-coordinates of the predicted dataset.

  • yerr_pre (array) – The error bars associated with the predicted dataset.

  • radius (float) – The radius value for comparison of points between datasets.

  • __plot_results__ (bool, optional) – If True, plot the results of the chi-square test. Defaults to False.

  • __print_results__ (bool, optional) – If True, print the results of the chi-square test. Defaults to True.

Returns:

  • float – The chi-square test statistic.

  • float – The p-value.

Raises:

ValueError – If the lengths of the datasets or error bars are not equal.

TelescopeML.StatVisAnalyzer.filter_dataframe(training_datasets, predicted_targets_dic)
TelescopeML.StatVisAnalyzer.filter_dataset_range(dataset, filter_params)

filer the dataframe

TelescopeML.StatVisAnalyzer.find_closest_chi_square(df, chi_square_statistic_list)

Find the closest chi-square test and p-value for a given degrees of freedom (df).

Parameters:
  • df (int) – Degrees of freedom for the chi-square test.

  • chi_square_statistic_list (list) – List of chi-square test statistics.

Returns:

  • closest_chi_square (float) – The closest chi-square test statistic.

  • closest_p_value (float) – The p-value corresponding to the closest chi-square test.

TelescopeML.StatVisAnalyzer.find_nearest_top_bottom(value, lst)

Find the nearest value in the list of data

TelescopeML.StatVisAnalyzer.interpolate_df(dataset, predicted_targets_dic, print_results_=False)

Interpolate the training set.

Parameters:
  • dataset (array) – The training dataset to be interpolated.

  • predicted_targets_dic (dict) – Target features to be interpolated.

TelescopeML.StatVisAnalyzer.plot_ML_model_loss(trained_ML_model_history=None, title=None)

Plot the trained model history for all individual target features

TelescopeML.StatVisAnalyzer.plot_boxplot(data, title=None, xlabel='Wavelength [$\\mu$m]', ylabel='Scaled Values', xticks_list=None, fig_size=(14, 3), __save_plots__=False)

Make a boxplot with the scaled features.

Description

  • Median: middle quartile marks.

  • Inter-quartile range (The middle “box”): 50% of scores fall within the inter-quartile range.

  • Upper quartile: 75% of the scores fall below the upper quartile.

  • Lower quartile: 25% of scores fall below the lower quartile.

TelescopeML.StatVisAnalyzer.plot_boxplot_hist(data, x_label, xy_loc)
TelescopeML.StatVisAnalyzer.plot_chi_square_p_value(radius, chi_square_list, p_value_list)

Plot two lines on the same plot with twin y-axis.

Parameters:
  • radius (array) – The x-axis values.

  • chi_square_list (array) – The y-axis values for the first line.

  • p_value_list (array) – The y-axis values for the second line.

Returns:

(displays the plot).

Return type:

None

TelescopeML.StatVisAnalyzer.plot_filtere_data(dataset, filter_bounds, feature_to_plot, title_label, wl_synthetic, output_names, __reference_data__, __save_plots__=False)

Plot a DataFrame with a single x-axis (using column names) and multiple y-axes.

Parameters:

df (-) – DataFrame containing the data to be plotted.

TelescopeML.StatVisAnalyzer.plot_filtered_dataframe_notUsed(dataset, filter_bounds, feature_to_plot, title_label, wl_synthetic, __reference_data__)

Plot a DataFrame with a single x-axis (using column names) and multiple y-axes.

Parameters:

df (-) – DataFrame containing the data to be plotted.

TelescopeML.StatVisAnalyzer.plot_pred_vs_obs_errorbar(object_name, x_obs, y_obs, y_obs_error, training_dataset, x_pred, predicted_targets_dic, __print_results__=False)

Plot predicted spectra along with observed spectra and error bars.

Parameters:
  • object_name (str) – Name of the object being plotted.

  • x_obs (list) – List of x-axis values (wavelengths) for the observed spectra.

  • y_obs (list) – List of y-axis values (observed feature values) for the observed spectra.

  • y_obs_error (list) – List of error values corresponding to the observed feature values.

  • training_datasets (list, optional) – Training (or synthetic) datasets used for training the models. Default is None.

  • predicted_targets_dic (dict, optional) – Dictionary of predicted targets. Default is None.

  • __print_results__ (bool) – True or False.

TelescopeML.StatVisAnalyzer.plot_pred_vs_obs_errorbar_stat_bokeh(stat_df, confidence_level, object_name, x_obs, y_obs, y_obs_err, training_datasets, x_pred, predicted_targets_dic, radius, __print_results__=False)

Plot observed spectra with error bars and predicted spectra with confidence intervals.

Parameters:
  • stat_df (DataFrame) – DataFrame containing the calculated statistics.

  • confidence_level (float) – Confidence level for the confidence intervals.

  • object_name (str) – Name of the object being plotted.

  • x_obs (list) – List of x-axis values for the observed spectra.

  • y_obs (list) – List of y-axis values for the observed spectra.

  • y_obs_err (list) – List of error values corresponding to the observed spectra.

  • training_datasets (optional) – Training datasets used for prediction. Default is None.

  • predicted_targets_dic (optional) – Dictionary of predicted targets. Default is None.

  • bd_object_class (#) –

  • None. (# Object class. Default is) –

  • __print_results__ (bool) – True or False.

TelescopeML.StatVisAnalyzer.plot_pred_vs_obs_errorbar_stat_matplotlib(stat_df, confidence_level, object_name, x_obs, y_obs, y_obs_err, training_datasets, x_pred, predicted_targets_dic, radius, __print_results__=False)

Plot observed spectra with error bars and predicted spectra with confidence intervals.

Parameters:
  • stat_df (DataFrame) – DataFrame containing the calculated statistics.

  • confidence_level (float) – Confidence level for the confidence intervals.

  • object_name (str) – Name of the object being plotted.

  • x_obs (list) – List of x-axis values for the observed spectra.

  • y_obs (list) – List of y-axis values for the observed spectra.

  • y_obs_err (list) – List of error values corresponding to the observed spectra.

  • training_datasets (optional) – Training datasets used for prediction. Default is None.

  • predicted_targets_dic (optional) – Dictionary of predicted targets. Default is None.

  • bd_object_class (#) –

  • None. (# Object class. Default is) –

  • __print_results__ (bool) – True or False.

TelescopeML.StatVisAnalyzer.plot_regression_report(trained_ML_model, trained_DataProcessor, Xtrain, Xtest, ytrain, ytest, target_i, xy_top=None, xy_bottom=None, __print_results__=False, __save_plots__=False)

Generate a regression report for the trained ML/CNN model.

Parameters:
  • trained_ML_model (object) – Trained regression model.

  • trained_DataProcessor (object) – Trained Data Processor Class

  • Xtrain (array) – Training set.

  • Xtest (array) – Test set.

  • ytrain (array) – Training target set.

  • ytest (array) – Test target set.

  • target_i (int) – Index of the target variable to analyze.

  • xy_top (list, optional) – Coordinates for annotations in the top plot. Defaults to [0.55, 0.85].

  • xy_bottom (list, optional) – Coordinates for annotations in the bottom plot. Defaults to [0.05, 0.8].

  • __print_results__ (bool, optional) – True or False.

TelescopeML.StatVisAnalyzer.plot_scatter_x_y(x, y, plot_title='Scatter Plot', x_label='X-axis Label', y_label='Y-axis Label', plot_width=800, plot_height=400)
TelescopeML.StatVisAnalyzer.plot_spectra_errorbar(object_name, x_obs, y_obs, y_obs_err, y_label='Flux (F𝜈) [erg/s/cm2/Hz]', title_label=None, data_type='x_y_yerr')
TelescopeML.StatVisAnalyzer.plot_tricontour_chi2_radius(tuned_ML_R_param_df, list_=['temperature', 'gravity', 'metallicity', 'c_o_ratio'], __save_plot__=False)
TelescopeML.StatVisAnalyzer.plot_with_errorbars(x_obs, y_obs, err_obs, x_pre, y_pre, err_pre, title='Data with Error Bars')

Create a Bokeh plot with custom error bars for two datasets.

Parameters:
  • x_obs (array) – X-axis values for observed dataset.

  • y_obs (array) – Y-axis values for observed dataset.

  • err_obs (array) – Error bars for observed dataset (positive values).

  • x_pre (array) – X-axis values for predicted dataset.

  • y_pre (array) – Y-axis values for predicted dataset.

  • err_pre (array) – Error bars for predicted dataset (positive values).

  • title (str) – Title of the plot (default is “Data with Error Bars”).

Returns:

(Displays the plot).

Return type:

None

TelescopeML.StatVisAnalyzer.print_results_fun(targets, print_title=None)

Print the outputs in a pretty format using the pprint library.

Parameters:
  • targets (any) – The data to be printed.

  • print_title (str) – An optional title to display before the printed data.

TelescopeML.StatVisAnalyzer.replace_zeros_with_mean(dataframe_col)

Replace zero values in a DataFrame column with the mean of their non-zero neighbors.

Parameters:

dataframe_col (pandas.Series) – A pandas Series representing the column of a DataFrame.

Returns:

The updated pandas Series with zero values replaced by the mean of non-zero neighbors.

Return type:

pandas.Series