Skip to content

Commit

Permalink
I/O Refactoring (#2652)
Browse files Browse the repository at this point in the history
* Moves parse_input to IO and removes unused file

* Removes unused file and imports

* Separates parse_input into chunks

Also cleans up imports

* Deprecates old CMFGen reader and moves new one

* Fixes logging import

* Fixes import sorting

* Consistent file naming

* Consistent names and ordering for parsing functions

_from_config and _from_csvy to match typical class methods

Config first, CSVY second

* Abundances renamed to mass fractions in IO

With small extensions outside that area

* Pluralise

* Fixes mass fraction and density dimension mismatch for CSVY models

* Adds docstring

* black

* Adds dummy type variable to schema for convergence

Should fix read/write issue.

* Cleanup of structure config reading

Not really happy with it, but helps show some of the current problems with the config arrangement compared to the code

* Fixes error with density time point and black

* Fixes packet source re-init for custom sources

Also adjusts notebook to deal with quantity-based packet frequencies

* Resolve some escape sequence errors

* Plural mass fractions

* black

* Clarify docstrings
  • Loading branch information
andrewfullard authored Jun 26, 2024
1 parent 8aa9e3b commit 140bb96
Show file tree
Hide file tree
Showing 28 changed files with 1,141 additions and 2,075 deletions.
3 changes: 1 addition & 2 deletions docs/io/optional/how_to_custom_source.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
" truncation_frequency = (\n",
" u.Quantity(self.truncation_wavelength, u.Angstrom)\n",
" .to(u.Hz, equivalencies=u.spectral())\n",
" .value\n",
" )\n",
"\n",
" # Draw nus from blackbody distribution and reject based on truncation_frequency.\n",
Expand Down Expand Up @@ -220,7 +219,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down
17 changes: 1 addition & 16 deletions tardis/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
"""
A collection of subpackages and submodules to handle input and output data.
A collection of subpackages and submodules to handle input and output data.
"""

from tardis.io.configuration.config_internal import (
get_internal_configuration,
get_data_dir,
)

# readin model_data

from tardis.io.model.readers.generic_readers import (
read_simple_ascii_abundances,
)
from tardis.io.model.readers.generic_readers import (
read_simple_ascii_density,
)
from tardis.io.model.readers.base import read_density_file
12 changes: 12 additions & 0 deletions tardis/io/configuration/schemas/montecarlo_definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ definitions:
description: specifies the threshold that is taken as convergence (i.e.
0.05 means that the value does not change more than 5%)
minimum: 0
type:
type: string
default: 'damped'
description: THIS IS A DUMMY VARIABLE DO NOT USE
t_rad:
type: object
additionalProperties: false
Expand All @@ -69,6 +73,10 @@ definitions:
description: specifies the threshold that is taken as convergence (i.e.
0.05 means that the value does not change more than 5%)
minimum: 0
type:
type: string
default: 'damped'
description: THIS IS A DUMMY VARIABLE DO NOT USE
required:
- threshold
w:
Expand All @@ -85,6 +93,10 @@ definitions:
description: specifies the threshold that is taken as convergence (i.e.
0.05 means that the value does not change more than 5%)
minimum: 0
type:
type: string
default: 'damped'
description: THIS IS A DUMMY VARIABLE DO NOT USE
required:
- threshold
lock_t_inner_cycles:
Expand Down
2 changes: 1 addition & 1 deletion tardis/io/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tardis.io.model.readers.stella import read_stella_model

# from tardis.io.model.stella import read_stella_model
from tardis.io.model.cmfgen import read_cmfgen_model
from tardis.io.model.readers.cmfgen import read_cmfgen_model
75 changes: 0 additions & 75 deletions tardis/io/model/cmfgen.py

This file was deleted.

187 changes: 0 additions & 187 deletions tardis/io/model/density.py

This file was deleted.

Loading

0 comments on commit 140bb96

Please sign in to comment.