TelescopeML – I. An End-to-End Python Package for Interpreting Telescope Datasets through Training Machine Learning Models, Generating Statistical Reports, and Visualizing Results

We are on the verge of a revolutionary era in space exploration, thanks to advancements in telescopes such as the James Webb Space Telescope (\textit{JWST}). High-resolution, high signal-to-noise spectra from exoplanet and brown dwarf atmospheres have been collected over the past few decades, requiring the development of accurate and reliable pipelines and tools for their analysis. Accurately and swiftly determining the spectroscopic parameters from the observational spectra of these objects is crucial for understanding their atmospheric composition and guiding future follow-up observations. \texttt{TelescopeML} is a Python package developed to perform three main tasks: 1. Process the synthetic astronomical datasets for training a CNN model and prepare the observational dataset for later use for prediction; 2. Train a CNN model by implementing the optimal hyperparameters; and 3. Deploy the trained CNN models on the actual observational data to derive the output spectroscopic parameters.


Summary
We are on the verge of a revolutionary era in space exploration, thanks to advancements in telescopes such as the James Webb Space Telescope (JWST ).High-resolution, high signalto-noise spectra from exoplanet and brown dwarf atmospheres have been collected over the past few decades, requiring the development of accurate and reliable pipelines and tools for their analysis.Accurately and swiftly determining the spectroscopic parameters from the observational spectra of these objects is crucial for understanding their atmospheric composition and guiding future follow-up observations.TelescopeML is a Python package developed to perform three main tasks: 1. Process the synthetic astronomical datasets for training a CNN model and prepare the observational dataset for later use for prediction; 2. Train a CNN model by implementing the optimal hyperparameters; and 3. Deploy the trained CNN models on the actual observational data to derive the output spectroscopic parameters.

Statement of Need
We are in a new era of space exploration, thanks to advancements in ground-and space-based telescopes, such as the James Webb Space Telescope [JWST2023PASP] and CRIRES.These remarkable instruments collect high-resolution, high-signal-to-noise spectra from extrasolar planets [Alderson2023Nature], and brown dwarfs [Miles2023ApJ] atmospheres.Without accurate interpretation of this data, the main objectives of space missions will not be fully accomplished.Different analytical and statistical methods, such as the chi-squared-test, Bayesian statistics, and radiative-transfer atmospheric modeling packages have been developed With the continuous observation of these objects and the increasing amount of data, there is a critical need for a systematic pipeline to quickly explore the datasets and extract important physical parameters from them.In the future, we can expand our pipeline to exoplanet atmospheres, and use it to provide insights about the diversity of exoplanets and brown dwarfs' atmospheric compositions.Ultimately, TelescopeML will help facilitate the long-term analysis of this data in research.TelescopeML is an ML Python package with Sphinx-ed user-friendly documentation that provides both trained ML models and ML tools for interpreting observational data captured by telescopes.

Functionality and Key Features
TelescopeML is a Python package comprising a series of modules, each equipped with specialized machine learning and statistical capabilities for conducting Convolutional Neural Networks (CNN) or Machine Learning (ML) training on datasets captured from the atmospheres of extrasolar planets and brown dwarfs.The tasks executed by the TelescopeML modules are outlined below and visualized in the following figure: • DataMaster module: Performs various tasks to process the datasets, including: - • StatVisAnalyzer module: Provides a set of functions to perform the following tasks: -Explore and process the synthetic datasets -Perform the chi-square test to evaluate the similarity between two datasets -Calculate confidence intervals and standard errors

Details on the CNN Methodology for Multi-output Regression Problem
Each row in the synthetic spectra has 104 input variables.The order of these data points and their magnitude are crucial to interpret the telescope data.For this purpose, we implemented a Convolutional Neural Network (CNN) method with 1-D convolutional layers.CNN is a powerful technique for this study because it extracts the dominant features from these spectra and then passes them to the fully connected hidden layers to learn the patterns.The output layer predicts the four atmospheric targets.An example of the CNN architecture is depicted in the following figure:

Documentation
TelescopeML is available and being maintained as a GitHub repository at https://github.com/EhsanGharibNezhad/TelescopeML.Online documentation is hosted with Sphinx using ReadtheDocs tools and includes several instructions and tutorials as follows: • Main page: https://ehsangharibnezhad.github.io/TelescopeML/

Users and Future Developments
Astrophysicists with no prior machine learning knowledge can deploy the TelescopeML package and download the pre-trained ML or CNN models to interpret their observational data.In this scenario, pre-trained ML models, as well as the PyPI package, can be installed and deployed following the online instructions.Tutorials in the Sphinx documentation include examples for testing the code and also serve as a starting point.For this purpose, a basic knowledge of Python programming is required to install the code, run the tutorials, deploy the modules, and extract astronomical features from their datasets.The necessary machine learning background and a detailed guide for package installation, along with links to further Python details, are provided to help understand the steps and outputs.
Astrophysicists with machine learning expertise and data scientists can also benefit from this package by developing and fine-tuning the modules and pre-trained models to accommodate more complex datasets from various telescopes.This effort could also involve the utilization of new ML and deep learning algorithms, adding new capabilities such as feature engineering methods, and further optimization of hyperparameters using different and more efficient statistical techniques.The ultimate outcome from these two groups would be the creation of more advanced models with higher performance and robustness, as well as the extension of the package to apply to a wider range of telescope datasets.
[batalha2019picaso, MacDonald2023] to interpret the spectra.They utilize either forwardand/or retrieval-radiative transfer modeling to analyze the spectra and extract physical information, such as atmospheric temperature, metallicity, carbon-to-oxygen ratio, and surface gravity [line2014systematic, Iyer2023Sphinx, Marley2015].These atmospheric models rely on generating the physics and chemistry of these atmospheres for a wide range of thermal structures and compositions.In addition to Bayesian-based techniques, machine learning and deep learning methods have been developed in recent years for various astronomical problems, including confirming the classification of light curves for exoplanet validation [Valizadegan2022], recognizing molecular features [Zingales2018ExoGAN] as well as interpreting brown dwarfs spectra using Random Forest technique [Lueber2023RandomForesr_BDs].Here, we present one of the first applications of deep learning and convolutional neural networks on the interpretation of brown dwarf atmospheric datasets.The configuration of a CNN and the key concepts can be found in [Goodfellow_2016DeepLearning, KIRANYAZ2021].
Load the training dataset (i.e., atmospheric fluxes) in CSV format -Split the dataset into training, validation, and test sets to pass it to the CNN model -Scale/normalize the dataset column-wise or row-wise -Visualize the training sets in each of the processing steps for more insights -Perform feature engineering by extracting the Min and Max values from each flux to improve the ML training performance • DeepTrainer module: Utilizes different methods/packages such as TensorFlow to: -Load the processed dataset from the DataMaster module -Build Convolutional Neural Networks (CNNs) model using the tuned hyperparameters -Fit/train the CNN models given the epochs, learning rate, and other parameters -Visualize the loss and training history, as well as the trained model's performance • Predictor module: Implements the following tasks to predict atmospheric parameters: -Perform Scale/normalize processes on the observational fluxes -Deploy the trained CNNs model -Predict atmospheric parameters, i.e., effective temperature, gravity, carbon-tooxygen ratio, and metallicity -Visualize the processed observational dataset and the uncertainty in the predicted results

Figure 1 :
Figure 1: TelescopeML main modules to manipulate the training example, build the ML model, train and tune it, and ultimately extract the target features from the observational data.
The implications and scientific outcomes from the trained CNN models and this package are under revision for The Astrophysical Journal under the title TelescopeML -II: Convolutional Neural Networks for Predicting Brown Dwarf Atmospheric Parameters.