Skip to content

Commit

Permalink
for test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonu0305 committed Jan 2, 2025
1 parent e24ccce commit 55a190d
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 44 deletions.
13 changes: 12 additions & 1 deletion docs/tardis_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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


59 changes: 53 additions & 6 deletions docs/workflows/standard_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -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})"
]
},
{
Expand Down Expand Up @@ -88,7 +135,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "tardis",
"display_name": ".venv",
"language": "python",
"name": "python3"
},
Expand All @@ -102,7 +149,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.10.11"
}
},
"nbformat": 4,
Expand Down
12 changes: 6 additions & 6 deletions tardis/io/configuration/schemas/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 18 additions & 31 deletions tardis/io/logger/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 55a190d

Please # to comment.