From 55a190dbfa304d80ce1c63dc6408ad5e6050503b Mon Sep 17 00:00:00 2001 From: Swayam Shah Date: Thu, 2 Jan 2025 23:26:22 +0530 Subject: [PATCH] for test --- docs/tardis_example.yml | 13 +++++- docs/workflows/standard_workflow.ipynb | 59 +++++++++++++++++++++--- tardis/io/configuration/schemas/base.yml | 12 ++--- tardis/io/logger/logger.py | 49 ++++++++------------ 4 files changed, 89 insertions(+), 44 deletions(-) diff --git a/docs/tardis_example.yml b/docs/tardis_example.yml index 08d25b44eca..9224ddaa3f7 100644 --- a/docs/tardis_example.yml +++ b/docs/tardis_example.yml @@ -16,6 +16,9 @@ model: num: 20 density: type: branch85_w7 + w7_v_0: 2.5e9 cm/s + w7_rho_0: 1e-5 g/cm^3 + w7_time_0: 0.1 day abundances: type: uniform @@ -41,7 +44,7 @@ montecarlo: last_no_of_packets: 1.e+5 no_of_virtual_packets: 10 - + enable_full_relativity: false convergence_strategy: type: damped damping_constant: 1.0 @@ -51,7 +54,15 @@ montecarlo: t_inner: damping_constant: 0.5 + tracking: + initial_array_length: 1000 + track_rpacket: true + virtual_spectrum_spawn_range: 0.01 + debug_packets: false + logger_buffer: 1000 spectrum: start: 500 angstrom stop: 20000 angstrom num: 10000 + + diff --git a/docs/workflows/standard_workflow.ipynb b/docs/workflows/standard_workflow.ipynb index efdc3539c06..d698417431b 100644 --- a/docs/workflows/standard_workflow.ipynb +++ b/docs/workflows/standard_workflow.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -21,11 +21,58 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ - "workflow = StandardTARDISWorkflow(config, show_convergence_plots=True,show_progress_bars=True,convergence_plots_kwargs={\"export_convergence_plots\":True})" + "# from tardis.io.atom_data import download_atom_data\n", + "# download_atom_data('kurucz_cd23_chianti_H_He')" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\u001b[1mtardis.io.model.parse_atom_data\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\t\n", + "\tReading Atomic Data from ..\\kurucz_cd23_chianti_H_He.h5 (\u001b[1mparse_atom_data.py\u001b[0m:40)\n", + "[\u001b[1mtardis.io.atom_data.util\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\t\n", + "\tAtom Data kurucz_cd23_chianti_H_He.h5 not found in local path.\n", + "\tExists in TARDIS Data repo C:\\Users\\admin\\Downloads\\tardis-data\\kurucz_cd23_chianti_H_He.h5 (\u001b[1mutil.py\u001b[0m:34)\n", + "[\u001b[1mtardis.io.atom_data.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\tReading Atom Data with: UUID = 6f7b09e887a311e7a06b246e96350010 MD5 = 864f1753714343c41f99cb065710cace (\u001b[1mbase.py\u001b[0m:258)\n", + "[\u001b[1mtardis.io.atom_data.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\tNon provided Atomic Data: synpp_refs, photoionization_data, yg_data, two_photon_data, linelist_atoms, linelist_molecules (\u001b[1mbase.py\u001b[0m:262)\n", + "[\u001b[1mtardis.io.model.parse_density_configuration\u001b[0m][\u001b[1;33mWARNING\u001b[0m] \n", + "\tNumber of density points larger than number of shells. Assuming inner point irrelevant (\u001b[1mparse_density_configuration.py\u001b[0m:114)\n", + "[\u001b[1mtardis.model.matter.decay\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\tDecaying abundances for 1123200.0 seconds (\u001b[1mdecay.py\u001b[0m:101)\n", + "[\u001b[1mtardis.io.model.parse_atom_data\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\t\n", + "\tReading Atomic Data from ..\\kurucz_cd23_chianti_H_He.h5 (\u001b[1mparse_atom_data.py\u001b[0m:40)\n", + "[\u001b[1mtardis.io.atom_data.util\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\t\n", + "\tAtom Data kurucz_cd23_chianti_H_He.h5 not found in local path.\n", + "\tExists in TARDIS Data repo C:\\Users\\admin\\Downloads\\tardis-data\\kurucz_cd23_chianti_H_He.h5 (\u001b[1mutil.py\u001b[0m:34)\n", + "[\u001b[1mtardis.io.atom_data.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\tReading Atom Data with: UUID = 6f7b09e887a311e7a06b246e96350010 MD5 = 864f1753714343c41f99cb065710cace (\u001b[1mbase.py\u001b[0m:258)\n", + "[\u001b[1mtardis.io.atom_data.base\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\tNon provided Atomic Data: synpp_refs, photoionization_data, yg_data, two_photon_data, linelist_atoms, linelist_molecules (\u001b[1mbase.py\u001b[0m:262)\n", + "[\u001b[1mtardis.io.model.parse_density_configuration\u001b[0m][\u001b[1;33mWARNING\u001b[0m] \n", + "\tNumber of density points larger than number of shells. Assuming inner point irrelevant (\u001b[1mparse_density_configuration.py\u001b[0m:114)\n", + "[\u001b[1mtardis.model.matter.decay\u001b[0m][\u001b[1;37mINFO\u001b[0m ] \n", + "\tDecaying abundances for 1123200.0 seconds (\u001b[1mdecay.py\u001b[0m:101)\n" + ] + } + ], + "source": [ + "workflow = StandardTARDISWorkflow(config, show_convergence_plots=False,show_progress_bars=False,convergence_plots_kwargs={\"export_convergence_plots\":False})" ] }, { @@ -88,7 +135,7 @@ ], "metadata": { "kernelspec": { - "display_name": "tardis", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -102,7 +149,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.11" } }, "nbformat": 4, diff --git a/tardis/io/configuration/schemas/base.yml b/tardis/io/configuration/schemas/base.yml index 492379aa322..9250a1d8a0f 100644 --- a/tardis/io/configuration/schemas/base.yml +++ b/tardis/io/configuration/schemas/base.yml @@ -6,28 +6,28 @@ properties: type: string description: Version of the configuration file. The current version is 1.0 and no other versions are allowed supernova: - $ref: supernova.yml + $ref: "..\\supernova.yml" description: a section pertaining to observations of the supernova atom_data: type: string description: path or filename to the Atomic Data HDF5 file plasma: - $ref: plasma.yml + $ref: "..\\plasma.yml" description: configuration of the plasma microphysics csvy_model: type: string description: defining the model using csvy format (see :ref:`csvy-models`) model: - $ref: model.yml + $ref: "..\\model_definitions.yml" description: defining the model in the config yaml file montecarlo: - $ref: montecarlo.yml + $ref: "..\\montecarlo_definitions.yml" description: configuring the physics of the monte carlo radiative transfer spectrum: - $ref: spectrum.yml + $ref: "..\\spectrum.yml" description: Final spectrum sampling debug: - $ref: debug.yml + $ref: "..\\debug.yml" description: Debugging setup for the simulation required: - tardis_config_version diff --git a/tardis/io/logger/logger.py b/tardis/io/logger/logger.py index 44da5fa187f..f9dda8a6b33 100644 --- a/tardis/io/logger/logger.py +++ b/tardis/io/logger/logger.py @@ -77,41 +77,28 @@ def logging_state(log_level, tardis_config, specific_log_level): specific_log_level: boolean Allows to set specific logging levels. Logs of the `log_level` level would be output. """ - if "debug" in tardis_config: - specific_log_level = ( - tardis_config["debug"]["specific_log_level"] - if specific_log_level is None - else specific_log_level - ) - - logging_level = ( - log_level if log_level else tardis_config["debug"]["log_level"] - ) + # Ensure the debug section exists + if "debug" not in tardis_config: + tardis_config["debug"] = {} - # Displays a message when both log_level & tardis["debug"]["log_level"] are specified - if log_level and tardis_config["debug"]["log_level"]: - print( - "log_level is defined both in Functional Argument & YAML Configuration {debug section}" - ) - print( - f"log_level = {log_level.upper()} will be used for Log Level Determination\n" - ) + # Set specific_log_level if not provided + if specific_log_level is None: + specific_log_level = tardis_config["debug"].get("specific_log_level", DEFAULT_SPECIFIC_STATE) + # Set logging_level if not provided + if log_level is None: + logging_level = tardis_config["debug"].get("log_level", DEFAULT_LOG_LEVEL) else: - # Adds empty `debug` section for the YAML - tardis_config["debug"] = {} + logging_level = log_level - if log_level: - logging_level = log_level - else: - tardis_config["debug"]["log_level"] = DEFAULT_LOG_LEVEL - logging_level = tardis_config["debug"]["log_level"] - - if not specific_log_level: - tardis_config["debug"][ - "specific_log_level" - ] = DEFAULT_SPECIFIC_STATE - specific_log_level = tardis_config["debug"]["specific_log_level"] + # Displays a message when both log_level & tardis["debug"]["log_level"] are specified + if log_level and tardis_config["debug"].get("log_level"): + print( + "log_level is defined both in Functional Argument & YAML Configuration {debug section}" + ) + print( + f"log_level = {log_level.upper()} will be used for Log Level Determination\n" + ) logging_level = logging_level.upper() if logging_level not in LOGGING_LEVELS: