Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnnp #56

Closed
wants to merge 8 commits into from
Closed

dnnp #56

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:

- name: Generate and process changelog
run: |
CHANGELOG=$(git cliff --config pyproject.toml --unreleased | sed -n '/^## Changelog/,$p' | grep -vE '^(ERROR|WARN)')
CHANGELOG=$(git cliff --config pyproject.toml --unreleased --tag ${{ env.NEW_TAG }}| sed -n '/^## Changelog/,$p' | grep -vE '^(ERROR|WARN)')
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
Expand Down
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ Stuart Sim <[email protected]> ssim <[email protected]>
Stuart Sim <[email protected]> Stuart Sim <[email protected]>
Stuart Sim <[email protected]> Stuart Sim <[email protected]>

Swayam Shah <[email protected]> Sonu0305 <[email protected]>

TARDIS Bot <[email protected]>
TARDIS Bot <[email protected]> tardis-bot <[email protected]>
TARDIS Bot <[email protected]> TARDIS Bot <[email protected]>
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Changelog

### release-2024.12.29 (2024/12/28 20:05)
### release-2025.01.05 (2025/01/04 20:05)
- [2915](https://github.com/tardis-sn/tardis/pull/2915) Post-release 2024.12.29 (2915) (@tardis-bot)
### release-2024.12.29 (2024/12/23 04:39)
- [2909](https://github.com/tardis-sn/tardis/pull/2909) Post-release 2024.12.22 (2909) (@tardis-bot)
### release-2024.12.22 (2024/12/16 10:05)
- [2901](https://github.com/tardis-sn/tardis/pull/2901) Update test docs (2901) (@KasukabeDefenceForce)
Expand Down
8 changes: 4 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
cff-version: 1.0.3
message: If you use this software, please cite it using these metadata.
# FIXME title as repository name might not be the best name, please make human readable
title: 'tardis-sn/tardis: TARDIS v2024.12.29'
doi: 10.5281/zenodo.14567778
title: 'tardis-sn/tardis: TARDIS v2025.01.05'
doi: 10.5281/zenodo.14600165
# FIXME splitting of full names is error prone, please check if given/family name are correct
authors:
- given-names: Wolfgang
Expand Down Expand Up @@ -347,7 +347,7 @@ authors:
- given-names: Atharwa
family-names: Kharkar
affiliation:
version: release-2024.12.29
date-released: 2024-12-29
version: release-2025.01.05
date-released: 2025-01-05
repository-code: https://github.com/tardis-sn/tardis
license: cc-by-4.0
20 changes: 10 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ The following BibTeX entries are needed for the references:
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

.. |CITATION| replace:: kerzendorf_2024_14567778
.. |CITATION| replace:: kerzendorf_2025_14600165

.. |DOI_BADGE| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.14567778-blue
:target: https://doi.org/10.5281/zenodo.14567778
.. |DOI_BADGE| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.14600165-blue
:target: https://doi.org/10.5281/zenodo.14600165

.. code-block:: bibtex

@software{kerzendorf_2024_14567778,
@software{kerzendorf_2025_14600165,
author = {Kerzendorf, Wolfgang and
Sim, Stuart and
Vogl, Christian and
Expand Down Expand Up @@ -225,13 +225,13 @@ The following BibTeX entries are needed for the references:
Nayak U, Ashwin and
Kumar, Atul and
Kharkar, Atharwa},
title = {tardis-sn/tardis: TARDIS v2024.12.29},
month = dec,
year = 2024,
title = {tardis-sn/tardis: TARDIS v2025.01.05},
month = jan,
year = 2025,
publisher = {Zenodo},
version = {release-2024.12.29},
doi = {10.5281/zenodo.14567778},
url = {https://doi.org/10.5281/zenodo.14567778},
version = {release-2025.01.05},
doi = {10.5281/zenodo.14600165},
url = {https://doi.org/10.5281/zenodo.14600165},
}

*******
Expand Down
20 changes: 10 additions & 10 deletions docs/resources/credits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ The following BibTeX entries are needed for the references:
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

.. |CITATION| replace:: kerzendorf_2024_14567778
.. |CITATION| replace:: kerzendorf_2025_14600165

.. |DOI_BADGE| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.14567778-blue
:target: https://doi.org/10.5281/zenodo.14567778
.. |DOI_BADGE| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.14600165-blue
:target: https://doi.org/10.5281/zenodo.14600165

.. code-block:: bibtex

@software{kerzendorf_2024_14567778,
@software{kerzendorf_2025_14600165,
author = {Kerzendorf, Wolfgang and
Sim, Stuart and
Vogl, Christian and
Expand Down Expand Up @@ -189,12 +189,12 @@ The following BibTeX entries are needed for the references:
Nayak U, Ashwin and
Kumar, Atul and
Kharkar, Atharwa},
title = {tardis-sn/tardis: TARDIS v2024.12.29},
month = dec,
year = 2024,
title = {tardis-sn/tardis: TARDIS v2025.01.05},
month = jan,
year = 2025,
publisher = {Zenodo},
version = {release-2024.12.29},
doi = {10.5281/zenodo.14567778},
url = {https://doi.org/10.5281/zenodo.14567778},
version = {release-2025.01.05},
doi = {10.5281/zenodo.14600165},
url = {https://doi.org/10.5281/zenodo.14600165},
}

2 changes: 1 addition & 1 deletion docs/tardis_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ montecarlo:
spectrum:
start: 500 angstrom
stop: 20000 angstrom
num: 10000
num: 10000
Binary file added docs/workflows/luminosity.npy
Binary file not shown.
Binary file added docs/workflows/luminosity_integrated.npy
Binary file not shown.
Binary file added docs/workflows/luminosity_virtual.npy
Binary file not shown.
14 changes: 13 additions & 1 deletion docs/workflows/standard_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"metadata": {},
"outputs": [],
"source": [
"workflow = StandardTARDISWorkflow(config, show_convergence_plots=True,show_progress_bars=True,convergence_plots_kwargs={\"export_convergence_plots\":True})"
"workflow = StandardTARDISWorkflow(config, show_convergence_plots=False,show_progress_bars=False,convergence_plots_kwargs={\"export_convergence_plots\":True})"
]
},
{
Expand All @@ -37,6 +37,18 @@
"workflow.run()"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"np.save('luminosity.npy',workflow.spectrum_solver.spectrum_real_packets.luminosity.value)\n",
"np.save('luminosity_virtual.npy',workflow.spectrum_solver.spectrum_virtual_packets.luminosity.value)\n",
"np.save('luminosity_integrated.npy',workflow.spectrum_solver.spectrum_integrated.luminosity.value)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down
3 changes: 2 additions & 1 deletion tardis/io/atom_data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ def prepare_lines(self):
)
]

self.lines = self.lines.sort_values(by="wavelength")
# self.lines = self.lines.sort_values(by="wavelength")
self.lines = self.lines.sort_values(by=["wavelength"], kind="mergesort")

def prepare_line_level_indexes(self):
levels_index = pd.Series(
Expand Down
8 changes: 2 additions & 6 deletions tardis/io/model/parse_radiation_field_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
parse_structure_from_config,
)
from tardis.plasma.radiation_field import DilutePlanckianRadiationField
from tardis.radiation_field.validate_radiation_field import validate_radiative_temperature

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -113,12 +114,7 @@ def parse_radiation_field_state_from_csvy(
geometry, packet_source
)

if np.any(t_radiative < 1000 * u.K):
logging.critical(
"Radiative temperature is too low in some of the shells, temperatures below 1000K "
f"(e.g., T_rad = {t_radiative[np.argmin(t_radiative)]} in shell {np.argmin(t_radiative)} in your model) "
"are not accurately handled by TARDIS.",
)
validate_radiative_temperature(t_radiative)

if hasattr(csvy_model_data, "columns") and (
"dilution_factor" in csvy_model_data.columns
Expand Down
15 changes: 8 additions & 7 deletions tardis/io/model/readers/generic_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd
from astropy import units as u
from numpy import recfromtxt
from numpy import genfromtxt
from radioactivedecay import Nuclide
from radioactivedecay.utils import Z_DICT, elem_to_Z

Expand Down Expand Up @@ -44,12 +44,13 @@ def read_simple_ascii_density(
time_of_model_string = fh.readline().strip()
time_of_model = parse_quantity(time_of_model_string)

data = recfromtxt(
fname,
skip_header=1,
names=("index", "velocity", "density"),
dtype=(int, float, float),
)
data = genfromtxt(
fname,
skip_header=1,
names=("index", "velocity", "density"),
encoding='utf-8',
)
np.savetxt("data.txt", data)
velocity = (data["velocity"] * u.km / u.s).to("cm/s")
mean_density = (data["density"] * u.Unit("g/cm^3"))[1:]

Expand Down
31 changes: 31 additions & 0 deletions tardis/radiation_field/validate_radiation_field.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import logging
import numpy as np
from astropy import units as u

logger = logging.getLogger(__name__)

def validate_radiative_temperature(t_radiative):
"""
Validates the radiative temperature to ensure it is physically reasonable.

Parameters
----------
t_radiative : Quantity
The radiative temperature array.

Raises
------
ValueError
If any radiative temperature is below 1000 K.
"""
if np.any(t_radiative < 1000 * u.K):
min_t_rad = t_radiative[np.argmin(t_radiative)]
min_shell = np.argmin(t_radiative)
logging.critical(
"Radiative temperature is too low in some of the shells, temperatures below 1000K "
f"(e.g., T_rad = {min_t_rad} in shell {min_shell} in your model) "
"are not accurately handled by TARDIS."
)
raise ValueError(
f"Radiative temperature below 1000 K detected: T_rad = {min_t_rad} in shell {min_shell}."
)
2 changes: 1 addition & 1 deletion tardis/transport/montecarlo/tests/test_rpacket_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_boundary_interactions(rpacket_tracker, regression_data):
# Hard coding the number of columns
# Based on the largest size of boundary_interaction array (60)
obtained_boundary_interaction = np.full(
(no_of_packets, 64),
(no_of_packets, 77),
[-1],
dtype=rpacket_tracker[0].boundary_interaction.dtype,
)
Expand Down
10 changes: 5 additions & 5 deletions tardis/visualization/tools/convergence_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
# Added the below as a (temporary) workaround to the latex
# labels on the convergence plots not rendering correctly.
import plotly
from IPython.display import display, HTML
# from IPython.display import display, HTML

plotly.offline.init_notebook_mode()
display(HTML(
'<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_SVG"></script>'
))
# plotly.offline.init_notebook_mode()
# display(HTML(
# '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_SVG"></script>'
# ))


def transition_colors(length, name="jet"):
Expand Down
2 changes: 1 addition & 1 deletion tardis/workflows/standard_tardis_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_convergence_estimates(self, transport_state):
"Absorbed": [absorbed_luminosity.value, "value"],
"Requested": [self.luminosity_requested.value, "value"],
}
self.update_convergence_plot_data(plot_data)
self.update_convergence_plot_data(plot_data)

logger.info(
f"\n\tLuminosity emitted = {emitted_luminosity:.3e}\n"
Expand Down
35 changes: 35 additions & 0 deletions tardis/workflows/standard_workflow_runnner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
# import sys
# print(f"Working Directory: {os.getcwd()}")
# print(f"PYTHONPATH: {sys.path}")
# print(f"Environment: {dict(os.environ)}")
import time
# time.sleep(10)

from tardis.io.configuration.config_reader import Configuration
from tardis.workflows.standard_tardis_workflow import StandardTARDISWorkflow


yaml_file_path = '/Users/atharva/workspace/code/tardis-main/tardis/docs/tardis_example.yml'
print(f"Current working directory: {os.getcwd()}")
print(f"About to load YAML config from: {yaml_file_path}") # If yaml_file_path exists


# Create configuration from YAML file
config = Configuration.from_yaml(
yaml_file_path
)

# Set debug configuration
config.debug = {}
config.debug.log_level = "WARNING"
config.debug.specific_log_level = "WARNING"

# Initialize and run workflow
workflow = StandardTARDISWorkflow(
config,
show_convergence_plots=False,
show_progress_bars=False,
convergence_plots_kwargs={"export_convergence_plots": True}
)
workflow.run()
Loading