diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2be190d2f..0ebef677c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,9 +23,11 @@ env: CHIANTI_DB_VER: CHIANTI_v9.0.1_database.tar.gz PYTEST_FLAGS: --remote-data --runslow --test-db=carsus-db/test_databases/test.db --refdata=carsus-refdata --cov=carsus --cov-report=xml - --cov-report=html + --cov-report=html --arraydiff --arraydiff-reference-path=carsus-refdata/arraydiff NBCONVERT_CMD: jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to html CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + CMFGEN_DL_URL: http://kookaburra.phyast.pitt.edu/hillier/cmfgen_files + CMFGEN_DB_VER: atomic_data_15nov16.tar.gz jobs: build: @@ -77,6 +79,18 @@ jobs: wget -q ${{ env.CHIANTI_DL_URL }}/${{ env.CHIANTI_DB_VER }} -O ${{ env.XUVTOP }}/chianti.tar.gz tar -zxf ${{ env.XUVTOP }}/chianti.tar.gz -C ${{ env.XUVTOP }} if: steps.chianti-cache.outputs.cache-hit != 'true' + + - uses: actions/cache@v2 + with: + path: /tmp/atomic + key: ${{ env.CMFGEN_DB_VER }} + id: cmfgen-cache + + - name: Download CMFGEN database + run: | + wget -q -U "Mozilla/4.0" ${{ env.CMFGEN_DL_URL }}/${{ env.CMFGEN_DB_VER }} -O /tmp/atomic.tar.gz + tar -zxf /tmp/atomic.tar.gz -C /tmp + if: steps.cmfgen-cache.outputs.cache-hit != 'true' - name: Setup environment uses: conda-incubator/setup-miniconda@v2 diff --git a/README.rst b/README.rst index 59f2a7a05..5aa54aa4a 100644 --- a/README.rst +++ b/README.rst @@ -17,8 +17,8 @@ sources and output them to file formats readable by radiative transfer codes. :target: https://tardis-sn.github.io/carsus :alt: docs -.. image:: https://github.com/tardis-sn/carsus/actions/workflows/unit-tests.yml/badge.svg - :target: https://github.com/tardis-sn/carsus/actions/workflows/unit-tests.yml +.. image:: https://github.com/tardis-sn/carsus/actions/workflows/tests.yml/badge.svg + :target: https://github.com/tardis-sn/carsus/actions/workflows/tests.yml :alt: tests .. image:: https://badges.gitter.im/Join%20Chat.svg diff --git a/carsus/data/cmfgen_config.yml b/carsus/data/cmfgen_config.yml index b7235c8da..7101dcc58 100644 --- a/carsus/data/cmfgen_config.yml +++ b/carsus/data/cmfgen_config.yml @@ -89,7 +89,7 @@ atom: Co: ion_charge: 1: - date: 30oct12 + date: 15nov11 osc: fin_osc_bound col: Co2_COL_DATA pho: @@ -113,7 +113,7 @@ atom: - niphot_c.dat - niphot_d.dat 1: - date: 12sep12 + date: 23jan06 osc: fin_osc col: n2col.dat pho: diff --git a/carsus/io/__init__.py b/carsus/io/__init__.py index 19c5d2dfd..fb7d2a1bd 100644 --- a/carsus/io/__init__.py +++ b/carsus/io/__init__.py @@ -1,6 +1,10 @@ +import os from carsus.io.nist import NISTIonizationEnergiesParser, NISTIonizationEnergiesIngester,\ NISTWeightsCompPyparser, NISTWeightsCompIngester -from carsus.io.chianti_ import ChiantiIonReader, ChiantiIngester from carsus.io.kurucz import GFALLReader, GFALLIngester from carsus.io.output import AtomData from carsus.io.zeta import KnoxLongZetaIngester +from carsus.io.atom_data_compare import AtomDataCompare + +if "XUVTOP" in os.environ: + from carsus.io.chianti_ import ChiantiIonReader, ChiantiIngester diff --git a/carsus/io/atom_data_compare.py b/carsus/io/atom_data_compare.py new file mode 100644 index 000000000..b7efdd8b6 --- /dev/null +++ b/carsus/io/atom_data_compare.py @@ -0,0 +1,443 @@ +import pandas as pd +import numpy as np +import functools +import logging +from carsus.util import parse_selected_species, convert_atomic_number2symbol +from collections import defaultdict + +from collections import defaultdict +import matplotlib.pyplot as plt + +logger = logging.getLogger(__name__) + +LIGHT_GREEN = "#BCF5A9" +LIGHT_RED = "#F5A9A9" + + +def highlight_values(val): + """ + Return hex string of background color. + + Parameters + ---------- + val : bool + + Returns + ------- + string + """ + if val == True: + return f"background-color: {LIGHT_GREEN}" + else: + return f"background-color: {LIGHT_RED}" + + +class AtomDataCompare(object): + """ + Differentiate between two Carsus atomic files. + + Parameters + ---------- + d1_path : string + Path to the first file. + d2_path : string + Path to the second file. + alt_keys : dict, optional + Alternate names to dataframes inside the atomic files. + For example, the `lines` dataframe was used to be called `lines_data` in earlier carsus versions. + """ + + def __init__(self, d1_path=None, d2_path=None, alt_keys={}): + self.d1_path = d1_path + self.d2_path = d2_path + self.alt_keys_default = { + "lines": ["lines_data", "lines"], + "levels": ["levels_data", "levels"], + "collisions": ["collisions_data", "collision_data"], + "photoionization_data": ["photoionization_data"], + } + self.alt_keys_default = defaultdict(list, self.alt_keys_default) + self.setup(alt_keys=alt_keys) + + def set_keys_as_attributes(self, alt_keys={}): + """ + Set dataframes as attributes. + + Parameters + ---------- + alt_keys : dict, optional + Alternate names to dataframes inside the atomic files. Defaults to {}. + """ + # alt keys should be a subset of this self.alt_keys_default + # other keys would be ignored + + for key, val in self.alt_keys_default.items(): + if alt_keys.get(key, None): + self.alt_keys_default[key].extend(alt_keys[key]) + + for item in val: + if self.d1.get_node(item): + setattr(self, f"{key}1", self.d1[item]) + if self.d2.get_node(item): + setattr(self, f"{key}2", self.d2[item]) + + def setup(self, alt_keys={}): + """ + Opeb HDF files using Pandas HDFStore. + + Parameters + ---------- + alt_keys : dict, optional + Alternate names to dataframes inside the atomic files. Defaults to {}. + """ + self.d1 = pd.HDFStore(self.d1_path) + self.d2 = pd.HDFStore(self.d2_path) + self.set_keys_as_attributes(alt_keys=alt_keys) + + def teardown(self): + """ + Close open HDF files. + """ + self.d1.close() + self.d2.close() + + def verify_key_diff(self, key_name): + """ + Check if dataframes can be compared. + + Parameters + ---------- + key_name : string + """ + try: + df1 = getattr(self, f"{key_name}1") + df2 = getattr(self, f"{key_name}2") + except AttributeError as exc: + raise Exception( + f"Either key_name: {key_name} is invalid or keys are not set. " + "Please use the set_keys_as_attributes method to set keys as attributes for comparison." + ) + + species1 = df1.index.get_level_values("atomic_number") + species1 = set([convert_atomic_number2symbol(item) for item in species1]) + + species2 = df2.index.get_level_values("atomic_number") + species2 = set([convert_atomic_number2symbol(item) for item in species2]) + + species_diff = species1.symmetric_difference(species2) + if len(species_diff): + print(f"Elements not in common in both dataframes: {species_diff}") + + common_columns = df2.columns.intersection(df1.columns) + if common_columns.empty: + raise ValueError("There are no common columns for comparison. Exiting.") + + mismatched_cols = df2.columns.symmetric_difference(df1.columns) + if not mismatched_cols.empty: + logger.warning("Columns do not match.") + logger.warning(f"Mismatched columns: {mismatched_cols}") + logger.info(f"Using common columns for comparison:{common_columns}") + + if df1.index.names != df2.index.names: + raise ValueError("Index names do not match.") + + setattr(self, f"{key_name}_columns", common_columns) + + def ion_diff( + self, + key_name, + ion, + rtol=1e-07, + simplify_output=True, + return_summary=False, + style=True, + style_axis=0, + ): + """ + Compare two dataframes- ion wise. + + Parameters + ---------- + key_name : string + ion: string or tuple + rtol: int + simplify_output: bool + return_summary: bool + style: bool + style_axis: int or None + """ + try: + df1 = getattr(self, f"{key_name}1") + df2 = getattr(self, f"{key_name}2") + except AttributeError as exc: + raise Exception( + f"Either key_name: {key_name} is invalid or keys are not set." + "Please use the set_keys_as_attributes method to set keys as attributes for comparison." + ) + + if not hasattr(self, f"{key_name}_columns"): + self.verify_key_diff(key_name) + + common_columns = getattr(self, f"{key_name}_columns") + + if not isinstance(ion, tuple): + parsed_ion = parse_selected_species(ion)[0] + else: + parsed_ion = ion + + try: + df1 = df1.loc[parsed_ion] + df2 = df2.loc[parsed_ion] + except KeyError as exc: + raise Exception( + "The element does not exist in one of the dataframes." + ) from exc + + merged_df = pd.merge( + df1, + df2, + left_index=True, + right_index=True, + suffixes=["_1", "_2"], + ) + + non_numeric_cols = ["line_id", "metastable"] # TODO + common_cols_rearranged = [] + + for item in common_columns: + if item in non_numeric_cols: + merged_df[f"matches_{item}"] = ( + merged_df[f"{item}_1"] == merged_df[f"{item}_2"] + ) + common_cols_rearranged.extend( + [ + f"{item}_1", + f"{item}_2", + f"matches_{item}", + ] + ) + else: + merged_df[f"matches_{item}"] = np.isclose( + merged_df[f"{item}_1"], merged_df[f"{item}_2"], rtol=rtol + ) + merged_df[f"pct_change_{item}"] = merged_df[ + [f"{item}_1", f"{item}_2"] + ].pct_change(axis=1)[f"{item}_2"] + + merged_df[f"pct_change_{item}"] = merged_df[ + f"pct_change_{item}" + ].fillna(0) + + common_cols_rearranged.extend( + [f"{item}_1", f"{item}_2", f"matches_{item}", f"pct_change_{item}"] + ) + + merged_df = merged_df[common_cols_rearranged] + merged_df = merged_df.sort_values(by=merged_df.index.names, axis=0) + merged_df.apply( + lambda column: column.abs() if column.dtype.kind in "iufc" else column + ) + + if return_summary: + summary_dict = {} + summary_dict["total_rows"] = len(merged_df) + + for column in merged_df.copy().columns: + if column.startswith("matches_"): + summary_dict[column] = ( + merged_df[column].copy().value_counts().get(True, 0) + ) + summary_df = pd.DataFrame(summary_dict, index=["values"]) + return summary_df + + if simplify_output: + matches_cols = [ + column for column in merged_df.columns if column.startswith("matches") + ] + conditions = [merged_df[column] != True for column in matches_cols] + + merged_df = self.simplified_df(merged_df.copy()) # TODO + merged_df = merged_df[functools.reduce(np.logical_or, conditions)] + + if merged_df.empty: + print("All the values in both the dataframes match.") + return None + + merged_df = merged_df.drop( + columns=[ + column + for column in merged_df.columns + if column.startswith("matches") + ] + ) + + if style: + pct_change_subset = [ + column + for column in merged_df.columns + if column.startswith("pct_change") + ] + return merged_df.style.background_gradient( + cmap="Reds", subset=pct_change_subset, axis=style_axis + ) + + return merged_df + + def key_diff( + self, key_name, rtol=1e-07, simplify_output=True, style=True, style_axis=0 + ): + """ + Compare two dataframes. + + Parameters + ---------- + key_name : string + simplify_output: bool + style: bool + style_axis: int or None + """ + if not hasattr(self, f"{key_name}_columns"): + self.verify_key_diff(key_name) + + df1 = getattr(self, f"{key_name}1") + df2 = getattr(self, f"{key_name}2") + + ions1 = set( + [(atomic_number, ion_number) for atomic_number, ion_number, *_ in df1.index] + ) + ions2 = set( + [(atomic_number, ion_number) for atomic_number, ion_number, *_ in df2.index] + ) + + ions = set(ions1).intersection(ions2) + ion_diffs = [] + for ion in ions: + ion_diff = self.ion_diff( + key_name=key_name, ion=ion, rtol=rtol, return_summary=True + ) + ion_diff["atomic_number"], ion_diff["ion_number"] = ion + ion_diff = ion_diff.set_index(["atomic_number", "ion_number"]) + ion_diffs.append(ion_diff) + key_diff = pd.concat(ion_diffs) + + columns = key_diff.columns + for column in columns: + if column.startswith("matches"): + key_diff[column] = key_diff["total_rows"] - key_diff[column] + key_diff = key_diff.rename(columns={column: f"not_{column}"}) + key_diff = key_diff.sort_values(["atomic_number", "ion_number"]) + + subset = [ + column for column in key_diff.columns if column.startswith("not_matches") + ] + conditions = [key_diff[column] != 0 for column in subset] + + if simplify_output: + key_diff = key_diff[functools.reduce(np.logical_or, conditions)] + + if style: + return key_diff.style.background_gradient( + cmap="Reds", subset=subset, axis=style_axis + ) + + return key_diff + + def generate_comparison_table(self): + """ + Generate empty comparison table. + """ + for index, file in enumerate((self.d1, self.d2)): + # create a dict to contain names of keys in the file + # and their alternate(more recent) names + file_keys = {item[1:]: item[1:] for item in file.keys()} + for original_keyname in self.alt_keys_default.keys(): + for file_key in file_keys.keys(): + alt_key_names = self.alt_keys_default.get(original_keyname, []) + + if file_key in alt_key_names: + # replace value with key name in self.alt_keys_default + file_keys[file_key] = original_keyname + + # flip the dict to create the dataframe + file_keys = {v: k for k, v in file_keys.items()} + df = pd.DataFrame(file_keys, index=["file_keys"]).T + df["exists"] = True + setattr(self, f"d{index+1}_df", df) + + joined_df = self.d1_df.join(self.d2_df, how="outer", lsuffix="_1", rsuffix="_2") + joined_df[["exists_1", "exists_2"]] = joined_df[ + ["exists_1", "exists_2"] + ].fillna(False) + self.comparison_table = joined_df + self.comparison_table["match"] = None + + def compare(self, exclude_correct_matches=False, drop_file_keys=True, style=True): + """ + Compare the two HDF files. + + Parameters + ---------- + exclude_correct_matches : bool + drop_file_keys: bool + style: bool + """ + if not hasattr(self, "comparison_table"): + self.generate_comparison_table() + + for index, row in self.comparison_table.iterrows(): + if row[["exists_1", "exists_2"]].all(): + row1_df = self.d1[row["file_keys_1"]] + row2_df = self.d2[row["file_keys_2"]] + if row1_df.equals(row2_df): + self.comparison_table.at[index, "match"] = True + else: + self.comparison_table.at[index, "match"] = False + else: + self.comparison_table.at[index, "match"] = False + + if exclude_correct_matches: + self.comparison_table = self.comparison_table[ + self.comparison_table.match == False + ] + if drop_file_keys: + self.comparison_table = self.comparison_table.drop( + columns=["file_keys_1", "file_keys_2"] + ) + if style: + return self.comparison_table.style.applymap( + highlight_values, subset=["exists_1", "exists_2", "match"] + ) + return self.comparison_table + + def simplified_df(self, df): + """ + Drop additional columns belonging to the original dataframes but were used for comparison. + + Parameters + ---------- + df : pd.DataFrame + """ + df_simplified = df.drop(df.filter(regex="_1$|_2$").columns, axis=1) + return df_simplified + + def plot_ion_diff(self, key_name, ion, column): + """ + Plot fractional difference between properties of ions. + + Parameters + ---------- + key_name : string + ion: string or tuple + column: string + """ + df = self.ion_diff( + key_name=key_name, ion=ion, style=False, simplify_output=False + ) + plt.scatter( + df[f"{column}_1"] / df[f"{column}_2"], + df[f"{column}_2"], + ) + + plt.xlabel(f"{column}$_1$/{column}$_2$") + plt.ylabel(f"{column}$_2$") + plt.show() diff --git a/carsus/io/chianti_/chianti_.py b/carsus/io/chianti_/chianti_.py index 192cbf9e7..df53b68ae 100644 --- a/carsus/io/chianti_/chianti_.py +++ b/carsus/io/chianti_/chianti_.py @@ -22,6 +22,7 @@ except ImportError: # Shamefully copied from their GitHub source: + import chianti.core as ch def versionRead(): """ Read the version number of the CHIANTI database @@ -32,7 +33,6 @@ def versionRead(): versionStr = vFile.readline() vFile.close() return versionStr.strip() - import chianti.core as ch logger = logging.getLogger(__name__) diff --git a/carsus/io/cmfgen/base.py b/carsus/io/cmfgen/base.py index d9be302bc..a4f3ed66f 100644 --- a/carsus/io/cmfgen/base.py +++ b/carsus/io/cmfgen/base.py @@ -932,7 +932,8 @@ def _get_levels_lines(self, data): ) ionization_energies = ionization_energies.set_index( ["atomic_number", "ion_charge"] - ).squeeze() + ) + ionization_energies = ionization_energies["ionization_energy"] self.ionization_energies = ionization_energies if "cross_sections" in reader.keys(): @@ -1021,31 +1022,31 @@ def _get_collisions( f"Entries having label(s): {', '.join(missing_labels)} will be dropped for ion: {ion}." ) - collisions["level_number_lower"] = lower_level_index - collisions["level_number_upper"] = upper_level_index + collisions["level_index_lower"] = lower_level_index + collisions["level_index_upper"] = upper_level_index collisions["gi"] = gi collisions = collisions.dropna( - subset=["level_number_lower", "level_number_upper"] + subset=["level_index_lower", "level_index_upper"] ) collisions["atomic_number"] = ion[0] - collisions["ion_number"] = ion[1] + collisions["ion_charge"] = ion[1] collisions = collisions.drop(columns=["label_lower", "label_upper"]) collisions = collisions.astype( { - "level_number_upper": int, - "level_number_lower": int, + "level_index_upper": int, + "level_index_lower": int, } ) collisions = collisions.set_index( [ "atomic_number", - "ion_number", - "level_number_lower", - "level_number_upper", + "ion_charge", + "level_index_lower", + "level_index_upper", ] ) # divide the dataframe by gi and remove the column diff --git a/carsus/io/nist/ionization.py b/carsus/io/nist/ionization.py index 09aad6858..9274d1ee0 100644 --- a/carsus/io/nist/ionization.py +++ b/carsus/io/nist/ionization.py @@ -59,6 +59,7 @@ def download_ionization_energies( 'unc_out': unc_out, 'biblio': biblio} data = {k: v for k, v in data.items() if v is not False} + data = {k:"on" if v is True else v for k, v in data.items()} logger.info("Downloading ionization energies from the NIST Atomic Spectra Database.") r = requests.post(IONIZATION_ENERGIES_URL, data=data) diff --git a/carsus/io/output/base.py b/carsus/io/output/base.py index 8456fca30..2e83432be 100644 --- a/carsus/io/output/base.py +++ b/carsus/io/output/base.py @@ -1,15 +1,17 @@ -import re +import copy import logging +import re + +import astropy.constants as const +import astropy.units as u import numpy as np import pandas as pd -import astropy.units as u -import astropy.constants as const from scipy import interpolate + +from carsus.model import MEDIUM_AIR, MEDIUM_VACUUM from carsus.util import (convert_atomic_number2symbol, - convert_wavelength_air2vacuum, - serialize_pandas_object, - hash_pandas_object) -from carsus.model import MEDIUM_VACUUM, MEDIUM_AIR + convert_wavelength_air2vacuum, hash_pandas_object, + serialize_pandas_object) # Wavelengths above this value are given in air GFALL_AIR_THRESHOLD = 2000 * u.AA @@ -51,7 +53,14 @@ def __init__(self, ): self.atomic_weights = atomic_weights - self.ionization_energies = ionization_energies + + if (cmfgen_reader is not None) and hasattr(cmfgen_reader, 'ionization_energies'): + combined_ionization_energies = copy.deepcopy(ionization_energies) + combined_ionization_energies.base = cmfgen_reader.ionization_energies.combine_first(ionization_energies.base) + self.ionization_energies = combined_ionization_energies + else: + self.ionization_energies = ionization_energies + self.gfall_reader = gfall_reader self.zeta_data = zeta_data self.chianti_reader = chianti_reader @@ -74,7 +83,12 @@ def __init__(self, ) else: if hasattr(cmfgen_reader, "collisions"): - self.collisions = cmfgen_reader.collisions + collisions = cmfgen_reader.collisions.copy() + collisions.index = collisions.index.rename( + ['atomic_number', 'ion_number', 'level_number_lower', 'level_number_upper'] + ) + + self.collisions = collisions self.collisions_metadata = cmfgen_reader.collisional_metadata elif hasattr(chianti_reader, "collisions"): @@ -1000,10 +1014,12 @@ def to_hdf(self, fname): """ import hashlib - import uuid import platform - import pytz + import uuid from datetime import datetime + + import pytz + from carsus import FORMAT_VERSION with pd.HDFStore(fname, 'w') as f: @@ -1023,6 +1039,12 @@ def to_hdf(self, fname): if hasattr(self, 'cross_sections'): f.put('/photoionization_data', self.cross_sections_prepared) + lines_metadata = pd.DataFrame( + data=[["format", "version", "1.0"]], + columns=["field", "key", "value"] + ).set_index(["field", "key"]) + f.put('/lines_metadata', lines_metadata) + meta = [] meta.append(('format', 'version', FORMAT_VERSION)) diff --git a/carsus/io/tests/test_chianti.py b/carsus/io/tests/test_chianti.py index 170b7dbc3..e828bf167 100644 --- a/carsus/io/tests/test_chianti.py +++ b/carsus/io/tests/test_chianti.py @@ -1,80 +1,113 @@ import pytest from numpy.testing import assert_almost_equal -from carsus.io.chianti_ import ChiantiIonReader, ChiantiIngester +from carsus.io.chianti_ import ChiantiIonReader, ChiantiIngester, ChiantiReader from carsus.model import Level, Ion, Line, ECollision slow = pytest.mark.skipif( - not pytest.config.getoption("--runslow"), - reason="need --runslow option to run" + not pytest.config.getoption("--runslow"), reason="need --runslow option to run" ) -@pytest.fixture(scope="module") -def ch_ion_reader(): - return ChiantiIonReader("ne_2") - - @pytest.fixture def ch_ingester(memory_session): - ions = 'ne 1; cl 3' + ions = "ne 1; cl 3" ingester = ChiantiIngester(memory_session, ions=ions) return ingester -@pytest.mark.parametrize("ion_name", ["ne_2", "n_5"]) -def test_chianti_bound_levels(ion_name): - ion_rdr = ChiantiIonReader(ion_name) - bound_levels = ion_rdr.bound_levels.reset_index() - assert bound_levels["level_index"].max() <= ion_rdr.last_bound_level +class TestChiantiIonReader: + @pytest.fixture(scope="class", params=["ne_2", "n_5"]) + def ch_ion_reader(self, request): + return ChiantiIonReader(request.param) + @pytest.mark.array_compare(file_format="pd_hdf") + def test_chianti_bound_levels(self, ch_ion_reader): + bound_levels = ch_ion_reader.bound_levels + return bound_levels -@pytest.mark.parametrize("ion_name", ["ne_2", "n_5"]) -def test_chianti_bound_lines(ion_name): - ion_rdr = ChiantiIonReader(ion_name) - bound_lines = ion_rdr.bound_lines.reset_index() - assert bound_lines["upper_level_index"].max() <= ion_rdr.last_bound_level + @pytest.mark.array_compare(file_format="pd_hdf") + def test_chianti_bound_lines(self, ch_ion_reader): + bound_lines = ch_ion_reader.bound_lines + return bound_lines + @pytest.mark.array_compare(file_format="pd_hdf") + def test_chianti_reader_read_levels(self, ch_ion_reader): + return ch_ion_reader.levels -@pytest.mark.parametrize("level_index, energy, energy_theoretical",[ - (1, 0, 0), - (21, 252953.5, 252954), -]) -def test_chianti_reader_read_levels(ch_ion_reader, level_index, energy, energy_theoretical): - row = ch_ion_reader.levels.loc[level_index] - assert_almost_equal(row['energy'], energy) - assert_almost_equal(row['energy_theoretical'], energy_theoretical) + @pytest.mark.array_compare(file_format="pd_hdf") + def test_chianti_reader_read_lines(self, ch_ion_reader): + return ch_ion_reader.lines + + @pytest.mark.array_compare(file_format="pd_hdf") + def test_chianti_reader_read_collisions(self, ch_ion_reader): + return ch_ion_reader.collisions @slow -@pytest.mark.parametrize("atomic_number, ion_charge, levels_count",[ - (10, 1, 138), - (17, 3, 5) -]) -def test_chianti_ingest_levels_count(memory_session, ch_ingester, atomic_number, ion_charge, levels_count): +@pytest.mark.parametrize( + "atomic_number, ion_charge, levels_count", [(10, 1, 138), (17, 3, 5)] +) +def test_chianti_ingest_levels_count( + memory_session, ch_ingester, atomic_number, ion_charge, levels_count +): ch_ingester.ingest(levels=True) - ion = Ion.as_unique(memory_session, atomic_number=atomic_number, ion_charge=ion_charge) + ion = Ion.as_unique( + memory_session, atomic_number=atomic_number, ion_charge=ion_charge + ) assert len(ion.levels) == levels_count @slow -@pytest.mark.parametrize("atomic_number, ion_charge, lines_count",[ - (10, 1, 1999) -]) -def test_chianti_ingest_lines_count(memory_session, ch_ingester, atomic_number, ion_charge, lines_count): +@pytest.mark.parametrize("atomic_number, ion_charge, lines_count", [(10, 1, 1999)]) +def test_chianti_ingest_lines_count( + memory_session, ch_ingester, atomic_number, ion_charge, lines_count +): ch_ingester.ingest(levels=True, lines=True) - ion = Ion.as_unique(memory_session, atomic_number=atomic_number, ion_charge=ion_charge) - cnt = memory_session.query(Line).join(Line.lower_level).filter(Level.ion==ion).count() + ion = Ion.as_unique( + memory_session, atomic_number=atomic_number, ion_charge=ion_charge + ) + cnt = ( + memory_session.query(Line) + .join(Line.lower_level) + .filter(Level.ion == ion) + .count() + ) assert cnt == lines_count @slow -@pytest.mark.parametrize("atomic_number, ion_charge, e_col_count",[ - (10, 1, 9453) -]) -def test_chianti_ingest_e_col_count(memory_session, ch_ingester, atomic_number, ion_charge, e_col_count): +@pytest.mark.parametrize("atomic_number, ion_charge, e_col_count", [(10, 1, 9453)]) +def test_chianti_ingest_e_col_count( + memory_session, ch_ingester, atomic_number, ion_charge, e_col_count +): ch_ingester.ingest(levels=True, collisions=True) - ion = Ion.as_unique(memory_session, atomic_number=atomic_number, ion_charge=ion_charge) - cnt = memory_session.query(ECollision).join(ECollision.lower_level).filter(Level.ion==ion).count() - assert cnt == e_col_count \ No newline at end of file + ion = Ion.as_unique( + memory_session, atomic_number=atomic_number, ion_charge=ion_charge + ) + cnt = ( + memory_session.query(ECollision) + .join(ECollision.lower_level) + .filter(Level.ion == ion) + .count() + ) + assert cnt == e_col_count + + +class TestChiantiReader: + @pytest.fixture(scope="class", params=["H-He", "N"]) + def ch_reader(self, request): + return ChiantiReader(ions=request.param, collisions=True, priority=20) + + @pytest.mark.array_compare(file_format="pd_hdf") + def test_levels(self, ch_reader): + return ch_reader.levels + + @pytest.mark.array_compare(file_format="pd_hdf") + def test_lines(self, ch_reader): + return ch_reader.lines + + @pytest.mark.array_compare(file_format="pd_hdf") + def test_cols(self, ch_reader): + return ch_reader.collisions diff --git a/carsus/io/tests/test_cmfgen.py b/carsus/io/tests/test_cmfgen.py index faf2ea870..0f9867e42 100644 --- a/carsus/io/tests/test_cmfgen.py +++ b/carsus/io/tests/test_cmfgen.py @@ -1,250 +1,259 @@ import os -import glob import pytest import numpy as np import pandas as pd -from io import StringIO -from numpy.testing import assert_allclose -from pandas.testing import assert_frame_equal -from carsus.io.cmfgen import (CMFGENEnergyLevelsParser, - CMFGENOscillatorStrengthsParser, - CMFGENCollisionalStrengthsParser, - CMFGENPhoCrossSectionsParser, - CMFGENHydLParser, - CMFGENHydGauntBfParser, - CMFGENReader - ) - -with_refdata = pytest.mark.skipif( - not pytest.config.getoption("--refdata"), - reason="--refdata folder not specified" +from carsus.io.cmfgen import ( + CMFGENEnergyLevelsParser, + CMFGENOscillatorStrengthsParser, + CMFGENCollisionalStrengthsParser, + CMFGENPhoCrossSectionsParser, + CMFGENHydLParser, + CMFGENHydGauntBfParser, + CMFGENReader, ) -si2_levels_head = """ -0.00 0.5 3s2_3p_2Po[1/2] meas 10 -287.24 1.5 3s2_3p_2Po[3/2] meas 10 -42824.29 0.5 3s_3p2_4Pe[1/2] meas 10 -42932.62 1.5 3s_3p2_4Pe[3/2] meas 10 -43107.91 2.5 3s_3p2_4Pe[5/2] meas 10 -""" - -si2_lines_head = """ -0.0 42824.29 1.148200e-05 0.5 0.5 233.5123 -0.0 42932.62 7.128000e-08 0.5 1.5 232.9231 -0.0 55309.35 1.527600e-03 0.5 1.5 180.8013 -0.0 65500.47 2.558000e-01 0.5 0.5 152.6707 -0.0 76665.35 2.124000e-01 0.5 0.5 130.4370 -""" - -si2_col_head = """ -3.1550 3.1150 3.0750 3.0450 3.0300 3.0100 2.9850 2.9450 2.8850 2.7900 2.5250 2.1800 1.835 1.5450 -0.2330 0.2530 0.2590 0.2575 0.2555 0.2535 0.2510 0.2480 0.2435 0.2380 0.2215 0.1995 0.172 0.1420 -0.4060 0.4090 0.4035 0.3945 0.3910 0.3875 0.3845 0.3805 0.3745 0.3665 0.3425 0.3075 0.264 0.2175 -0.3205 0.3115 0.3035 0.2975 0.2960 0.2955 0.2945 0.2925 0.2885 0.2815 0.2595 0.2290 0.194 0.1565 -1.3450 1.3800 1.3900 1.3700 1.3450 1.3050 1.2500 1.1850 1.1100 1.0300 0.8650 0.7150 0.585 0.4770 -""" +from carsus.io.cmfgen.util import * -@with_refdata -@pytest.fixture() -def si2_osc_kurucz_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'energy_levels', 'si2_osc_kurucz') +with_refdata = pytest.mark.skipif( + not pytest.config.getoption("--refdata"), reason="--refdata folder not specified" +) +data_dir = os.path.join(os.path.dirname(__file__), "data") -@with_refdata -@pytest.fixture() -def fevi_osc_kb_rk_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'oscillator_strengths', 'fevi_osc_kb_rk.dat') @with_refdata @pytest.fixture() -def p2_osc_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'oscillator_strengths', 'p2_osc') +def si1_reader(): + return CMFGENReader.from_config( + "Si 0-1", + atomic_path="/tmp/atomic", + collisions=True, + cross_sections=True, + ionization_energies=True, + temperature_grid=np.arange(2000, 50000, 2000), + drop_mismatched_labels=True, + ) -@with_refdata -@pytest.fixture() -def vi_osc_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'oscillator_strengths', 'vi_osc') -@with_refdata @pytest.fixture() -def he2_col_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'collisional_strengths', 'he2col.dat') +def cmfgen_refdata_fname(refdata_path, path): + subdirectory, fname = path + return os.path.join(refdata_path, "cmfgen", subdirectory, fname) -@with_refdata -@pytest.fixture() -def ariii_col_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'collisional_strengths', 'col_ariii') @with_refdata -@pytest.fixture() -def si2_col_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'collisional_strengths', 'si2_col') +@pytest.mark.array_compare(file_format="pd_hdf") +@pytest.mark.parametrize( + "path", + [ + ["energy_levels", "si2_osc_kurucz"], + ], +) +def test_CMFGENEnergyLevelsParser(cmfgen_refdata_fname): + parser = CMFGENEnergyLevelsParser(cmfgen_refdata_fname) + n = int(parser.header["Number of energy levels"]) + assert parser.base.shape[0] == n + return parser.base -@with_refdata -@pytest.fixture() -def si2_pho_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'photoionization_cross_sections', 'phot_nahar_A') @with_refdata -@pytest.fixture() -def coiv_pho_fname(refdata_path): - return os.path.join(refdata_path, 'cmfgen', 'photoionization_cross_sections', 'phot_data_gs') +@pytest.mark.array_compare(file_format="pd_hdf") +@pytest.mark.parametrize( + "path", + [ + ["oscillator_strengths", "fevi_osc_kb_rk.dat"], + ["oscillator_strengths", "p2_osc"], + ["oscillator_strengths", "vi_osc"], + ], +) +def test_CMFGENOscillatorStrengthsParser(cmfgen_refdata_fname): + parser = CMFGENOscillatorStrengthsParser(cmfgen_refdata_fname) + n = int(parser.header["Number of transitions"]) + assert parser.base.shape[0] == n + return parser.base @with_refdata -@pytest.fixture() -def hyd_l_fname(refdata_path): - return os.path.join( - refdata_path, - "cmfgen", - "photoionization_cross_sections", - "hyd_l_data.dat", - ) +@pytest.mark.array_compare(file_format="pd_hdf") +@pytest.mark.parametrize( + "path", + [ + ["collisional_strengths", "he2col.dat"], + ["collisional_strengths", "col_ariii"], + ], +) +def test_CMFGENCollisionalStrengthsParser(cmfgen_refdata_fname): + parser = CMFGENCollisionalStrengthsParser(cmfgen_refdata_fname) + return parser.base @with_refdata -@pytest.fixture() -def gbf_n_fname(refdata_path): - return os.path.join( - refdata_path, - "cmfgen", - "photoionization_cross_sections", - "gbf_n_data.dat", - ) +@pytest.mark.parametrize( + "path", + [ + ["photoionization_cross_sections", "phot_nahar_A"], + ["photoionization_cross_sections", "phot_data_gs"], + ], +) +@pytest.mark.array_compare(file_format="pd_hdf") +def test_CMFGENPhoCrossSectionsParser(cmfgen_refdata_fname): + parser = CMFGENPhoCrossSectionsParser(cmfgen_refdata_fname) + n = int(parser.header["Number of energy levels"]) + assert len(parser.base) == n + return parser.base[0] -@with_refdata -@pytest.fixture() -def si1_data_dict(si2_osc_kurucz_fname, si2_col_fname): - si1_levels = CMFGENEnergyLevelsParser(si2_osc_kurucz_fname).base # (carsus) Si 1 == Si II - si1_lines = CMFGENOscillatorStrengthsParser(si2_osc_kurucz_fname).base - si1_col = CMFGENCollisionalStrengthsParser(si2_col_fname).base - return {(14,1): dict(levels = si1_levels, lines = si1_lines, collisions = si1_col)} @with_refdata -@pytest.fixture() -def si1_reader(si1_data_dict): - return CMFGENReader(si1_data_dict, collisions=True) +@pytest.mark.array_compare(file_format="pd_hdf") +@pytest.mark.parametrize( + "path", + [ + ["photoionization_cross_sections", "hyd_l_data.dat"], + ], +) +def test_CMFGENHydLParser(cmfgen_refdata_fname): + parser = CMFGENHydLParser(cmfgen_refdata_fname) + assert parser.header["Maximum principal quantum number"] == "30" + return parser.base -@with_refdata -@pytest.fixture() -def si2_levels_head_df(): - return pd.read_csv(StringIO(si2_levels_head), delim_whitespace=True, names=['energy', 'j', 'label', 'method', 'priority']) @with_refdata -@pytest.fixture() -def si2_lines_head_df(): - return pd.read_csv(StringIO(si2_lines_head), delim_whitespace=True, names=['energy_lower', 'energy_upper', 'gf', 'j_lower', - 'j_upper', 'wavelength']) -@with_refdata -@pytest.fixture() -def si2_col_head_df(): - return pd.read_csv(StringIO(si2_col_head), delim_whitespace=True, names=range(14)) +@pytest.mark.array_compare(file_format="pd_hdf") +@pytest.mark.parametrize( + "path", + [ + ["photoionization_cross_sections", "gbf_n_data.dat"], + ], +) +def test_CMFGENHydGauntBfParser(cmfgen_refdata_fname): + parser = CMFGENHydGauntBfParser(cmfgen_refdata_fname) + assert parser.header["Maximum principal quantum number"] == "30" + return parser.base -@with_refdata -def test_si2_osc_kurucz(si2_osc_kurucz_fname): - parser = CMFGENEnergyLevelsParser(si2_osc_kurucz_fname) - n = int(parser.header['Number of energy levels']) - assert parser.base.shape[0] == n - assert list(parser.base.columns) == ['label', 'g', 'E(cm^-1)', '10^15 Hz', 'eV', 'Lam(A)', 'ID', 'ARAD', 'C4', 'C6'] @with_refdata -def test_fevi_osc_kb_rk(fevi_osc_kb_rk_fname): - parser = CMFGENOscillatorStrengthsParser(fevi_osc_kb_rk_fname) - n = int(parser.header['Number of transitions']) - assert parser.base.shape[0] == n - assert list(parser.base.columns) == ['label_lower', 'label_upper', 'f', 'A', 'Lam(A)', 'i', 'j', 'Lam(obs)', '% Acc'] - assert np.isclose(parser.base.iloc[0,2], 1.94e-02) +@pytest.mark.array_compare(file_format="pd_hdf") +def test_reader_lines(si1_reader): + return si1_reader.lines -@with_refdata -def test_p2_osc(p2_osc_fname): - parser = CMFGENOscillatorStrengthsParser(p2_osc_fname) - n = int(parser.header['Number of transitions']) - assert parser.base.shape[0] == n - assert list(parser.base.columns) == ['label_lower', 'label_upper', 'f', 'A', 'Lam(A)', 'i', 'j', 'Lam(obs)', '% Acc'] - assert np.isnan(parser.base.iloc[0,7]) - assert np.isclose(parser.base.iloc[0,8], 3.) - assert np.isnan(parser.base.iloc[1,7]) - assert np.isclose(parser.base.iloc[1,8], 25.) - assert np.isclose(parser.base.iloc[2,7], 1532.51) - assert np.isclose(parser.base.iloc[3,7], 1301.87) @with_refdata -def test_vi_osc(vi_osc_fname): - parser = CMFGENOscillatorStrengthsParser(vi_osc_fname) - assert parser.base.empty +@pytest.mark.array_compare(file_format="pd_hdf") +def test_reader_levels(si1_reader): + return si1_reader.levels -@with_refdata -def test_he2_col(he2_col_fname): - parser = CMFGENCollisionalStrengthsParser(he2_col_fname) - assert parser.base.shape[0] == 465 - assert parser.base.shape[1] == 11 - assert parser.base.iloc[-1,0] == '30___' - assert parser.base.iloc[-1,1] == 'I' @with_refdata -def test_ariii_col(ariii_col_fname): - parser = CMFGENCollisionalStrengthsParser(ariii_col_fname) - n = int(parser.header['Number of transitions']) - assert parser.base.shape == (n, 13) +@pytest.mark.array_compare(file_format="pd_hdf") +def test_reader_collisions(si1_reader): + return si1_reader.collisions -@with_refdata -def test_si2_pho(si2_pho_fname): - parser = CMFGENPhoCrossSectionsParser(si2_pho_fname) - n = int(parser.header['Number of energy levels']) - m = int(parser.base[0].attrs['Number of cross-section points']) - assert len(parser.base) == n - assert parser.base[0].shape == (m, 2) @with_refdata -def test_coiv_pho(coiv_pho_fname): - parser = CMFGENPhoCrossSectionsParser(coiv_pho_fname) - n = int(parser.header['Number of energy levels']) - assert len(parser.base) == n - assert parser.base[0].shape == (3, 8) +@pytest.mark.array_compare(file_format="pd_hdf") +def test_reader_cross_sections_squeeze(si1_reader): + return si1_reader.cross_sections @with_refdata -def test_hyd_l(hyd_l_fname): - parser = CMFGENHydLParser(hyd_l_fname) - assert parser.header["Maximum principal quantum number"] == "30" - assert parser.base.shape == (465, 97) - assert parser.base.loc[(11, 3)].values[5] == -6.226968 - assert parser.base.loc[(21, 20)].values[2] == -10.3071 - assert_allclose( - parser.base.columns[:4], [1.1 ** 0, 1.1 ** 1, 1.1 ** 2, 1.1 ** 3] +@pytest.mark.array_compare(file_format="pd_hdf") +def test_reader_ionization_energies(si1_reader): + return si1_reader.ionization_energies.to_frame() + + +@pytest.mark.array_compare +@pytest.mark.parametrize("threshold_energy_ryd", [0.053130732819562695]) +@pytest.mark.parametrize("fit_coeff_list", [[34.4452, 1.0, 2.0]]) +def test_get_seaton_phixs_table(threshold_energy_ryd, fit_coeff_list): + phixs_table = get_seaton_phixs_table(threshold_energy_ryd, *fit_coeff_list) + return phixs_table + + +@pytest.mark.array_compare +@pytest.mark.parametrize("hyd_gaunt_energy_grid_ryd", [{1: list(range(1, 3))}]) +@pytest.mark.parametrize("hyd_gaunt_factor", [{1: list(range(3, 6))}]) +@pytest.mark.parametrize("threshold_energy_ryd", [0.5]) +@pytest.mark.parametrize("n", [1]) +def test_get_hydrogenic_n_phixs_table( + hyd_gaunt_energy_grid_ryd, hyd_gaunt_factor, threshold_energy_ryd, n +): + hydrogenic_n_phixs_table = get_hydrogenic_n_phixs_table( + hyd_gaunt_energy_grid_ryd, hyd_gaunt_factor, threshold_energy_ryd, n ) - -@with_refdata -def test_gbf_n(gbf_n_fname): - parser = CMFGENHydGauntBfParser(gbf_n_fname) - assert parser.header["Maximum principal quantum number"] == "30" - assert parser.base.shape == (30, 145) - assert ( - round(parser.base.loc[3].values[3], 7) == 0.9433558 - ) # Rounding is needed as a result of undoing the unit conversion - assert round(parser.base.loc[18].values[11], 7) == 1.008855 - assert_allclose( - parser.base.columns[:4], [1.1 ** 0, 1.1 ** 1, 1.1 ** 2, 1.1 ** 3] + return hydrogenic_n_phixs_table + + +@pytest.mark.array_compare +@pytest.mark.parametrize("hyd_phixs_energy_grid_ryd", [{(4, 1): np.linspace(1, 3, 5)}]) +@pytest.mark.parametrize("hyd_phixs", [{(4, 1): np.linspace(1, 3, 5)}]) +@pytest.mark.parametrize("threshold_energy_ryd", [2]) +@pytest.mark.parametrize("n", [4]) +@pytest.mark.parametrize("l_start", [1]) +@pytest.mark.parametrize("l_end", [1]) +@pytest.mark.parametrize("nu_0", [0.2]) +def test_get_hydrogenic_nl_phixs_table( + hyd_phixs_energy_grid_ryd, hyd_phixs, threshold_energy_ryd, n, l_start, l_end, nu_0 +): + phixs_table = get_hydrogenic_nl_phixs_table( + hyd_phixs_energy_grid_ryd, + hyd_phixs, + threshold_energy_ryd, + n, + l_start, + l_end, + nu_0, ) + return phixs_table + + +@pytest.mark.array_compare +@pytest.mark.parametrize("threshold_energy_ryd", [2]) +@pytest.mark.parametrize("vars", [[3, 4, 5, 6, 7]]) +@pytest.mark.parametrize("n_points", [50]) +def test_get_opproject_phixs_table(threshold_energy_ryd, vars, n_points): + phixs_table = get_opproject_phixs_table(threshold_energy_ryd, *vars, n_points) + return phixs_table + + +@pytest.mark.array_compare +@pytest.mark.parametrize("threshold_energy_ryd", [2]) +@pytest.mark.parametrize("vars", [[2, 3, 4, 5, 6, 7, 8, 9]]) +@pytest.mark.parametrize("n_points", [50]) +def test_get_hummer_phixs_table(threshold_energy_ryd, vars, n_points): + phixs_table = get_hummer_phixs_table(threshold_energy_ryd, *vars, n_points) + return phixs_table + + +@pytest.mark.array_compare +@pytest.mark.parametrize("threshold_energy_ryd", [10]) +@pytest.mark.parametrize( + "fit_coeff_table", + [ + pd.DataFrame.from_dict( + { + "E": [1, 2], + "E_0": [1, 2], + "P": [2, 2], + "l": [2, 2], + "sigma_0": [1, 2], + "y(a)": [1, 3], + "y(w)": [1, 4], + } + ) + ], +) +@pytest.mark.parametrize("n_points", [50]) +def test_get_vy95_phixs_table(threshold_energy_ryd, fit_coeff_table, n_points): + phixs_table = get_vy95_phixs_table(threshold_energy_ryd, fit_coeff_table, n_points) + return phixs_table -@with_refdata -def test_reader_levels_shape(si1_reader): - assert si1_reader.levels.shape == (157, 5) -@with_refdata -def test_reader_lines_shape(si1_reader): - assert si1_reader.lines.shape == (4196, 6) +@pytest.mark.skip(reason="Not implemented yet") +def test_get_leibowitz_phixs_table(): + pass -@with_refdata -def test_reader_levels_head(si1_reader, si2_levels_head_df): - assert_frame_equal(si1_reader.levels.head(5).reset_index(drop=True), - si2_levels_head_df) -@with_refdata -def test_reader_lines_head(si1_reader, si2_lines_head_df): - assert_frame_equal(si1_reader.lines.head(5).reset_index(drop=True), - si2_lines_head_df) - -@with_refdata -def test_reader_col_head(si1_reader, si2_col_head_df): - assert_frame_equal(si1_reader.collisions.head(5).reset_index(drop=True), - si2_col_head_df) +@pytest.mark.array_compare +@pytest.mark.parametrize("threshold_energy_ryd", [50]) +def test_get_null_phixs_table(threshold_energy_ryd): + phixs_table = get_null_phixs_table(threshold_energy_ryd) + return phixs_table diff --git a/carsus_env3.yml b/carsus_env3.yml index 2dc432dee..5c9284929 100644 --- a/carsus_env3.yml +++ b/carsus_env3.yml @@ -4,31 +4,30 @@ channels: - conda-forge dependencies: - - python=3.6 + - python =3.7 - setuptools - setuptools_scm - pip - - numpy=1.15 - - pandas=1.0 - - astropy=3 - - chiantipy=0.8.4 - - typing-extensions=4.1 # https://github.com/python/typing/issues/1158 + - numpy =1.15 + - pandas =1.0 + - astropy =3 + - chiantipy =0.8.4 # I/O - pyyaml - uncertainties - - pyparsing=2.2 - - sqlalchemy=1.0 + - pyparsing =2.2 + - sqlalchemy =1.2 - beautifulsoup4 - html5lib - h5py - pytables - - pyarrow=0.14.1 - - glog=0.5 # https://github.com/google/glog/issues/814 + - pyarrow =0.14.1 + - glog =0.5 # https://github.com/google/glog/issues/814 - requests - roman -# --- Not required for conda-forge package --- +# --- Not required for an hypothetical conda-forge package --- # Analysis - notebook @@ -50,13 +49,10 @@ dependencies: - pandoc # Test/Coverage - - pytest=4 + - pytest =4 - pytest-cov - pytest-astropy - - # ChiantiPy - - scipy - - ipyparallel + - epassaro::pytest-arraydiff # Other - git-lfs diff --git a/docs/development/compare_atomic_files.ipynb b/docs/development/compare_atomic_files.ipynb index 57f23b392..50e536d3c 100644 --- a/docs/development/compare_atomic_files.ipynb +++ b/docs/development/compare_atomic_files.ipynb @@ -6,279 +6,14756 @@ "source": [ "# Compare Atomic Files\n", "\n", - "This notebook shows how to compare the `levels_prepared` and `lines_prepared` DataFrames of the atomic files generated by Carsus.\n", "\n", - "\n", - "Let's create two different TARDIS atomic files to use as examples." + "This notebook shows how to compare atomic files generated by Carsus." ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, + "execution_count": 20, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:24:10.056502Z", + "start_time": "2022-10-19T08:24:10.049836Z" + } + }, + "outputs": [], + "source": [ + "import os\n", + "import logging\n", + "from carsus.io import AtomDataCompare" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:24:10.203221Z", + "start_time": "2022-10-19T08:24:10.198932Z" + } + }, "outputs": [], "source": [ - "from carsus.io.nist import NISTWeightsComp, NISTIonizationEnergies\n", - "from carsus.io.kurucz import GFALLReader\n", - "from carsus.io.zeta import KnoxLongZeta\n", - "from carsus.io.chianti_ import ChiantiReader\n", - "from carsus.io.output import TARDISAtomData" + "ATOM1_PATH = os.environ.get(\"ATOM1_PATH\", None)\n", + "ATOM2_PATH = os.environ.get(\"ATOM2_PATH\", None)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:24:19.499649Z", + "start_time": "2022-10-19T08:24:19.411768Z" + }, + "scrolled": true + }, + "outputs": [], + "source": [ + "atc = AtomDataCompare(ATOM1_PATH, ATOM2_PATH)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "For the first atomic file we grab species `H-C` from GFALL and `H-He` from Chianti." + "A brief overview of what keys match can be seen using the comparison table." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:29:05.309556Z", + "start_time": "2022-10-19T08:29:04.029450Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
exists_1 exists_2 match
atom_dataTrueTrueFalse
collision_data_temperaturesFalseTrueFalse
collisionsFalseTrueFalse
ionization_dataTrueTrueFalse
levelsTrueTrueFalse
linesTrueTrueFalse
macro_atom_dataTrueTrueFalse
macro_atom_referencesTrueTrueFalse
metadataTrueFalseFalse
zeta_dataTrueTrueTrue
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "atc.compare()" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "atomic_weights = NISTWeightsComp()\n", - "ionization_energies = NISTIonizationEnergies('H-C')\n", - "gfall_reader = GFALLReader(ions='H-C')\n", - "chianti_reader = ChiantiReader(ions='H-He', collisions=True, priority=20)\n", - "zeta_data = KnoxLongZeta()" + "One can investigate further into the difference between the dataframes using the `key_diff` method. The `key_diff` method currently supports differentiating `levels`, `lines` and the `collisions` dataframes." ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 6, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:22:28.873130Z", + "start_time": "2022-10-19T08:22:22.458457Z" + }, + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
total_rows not_matches_energy not_matches_g not_matches_metastable
atomic_number ion_number
3067842
6082982565229
18557571
27968512
702762652024
11521371251
289675011
82137131924
313713110319
90117100721
116314411522
224223019815
31361231171
49073552
10026421716320
12792512154
26149463
395936510
46024164
1146657445
12053951641556
13027223226458
11921381235
140539485380110
196867012
21631351226
15023020416313
19174605
35039335
16015051543
18472643
241262114
17020919316420
112483674
1802112051618
130630125410
33718112
42115141
1923819142
213125140
2503212482555
291245102953
30225020417127
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "atom_data_a = TARDISAtomData(atomic_weights,\n", - " ionization_energies,\n", - " gfall_reader,\n", - " zeta_data,\n", - " chianti_reader)" + "atc.key_diff(\"levels\")" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 7, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:22:56.466013Z", + "start_time": "2022-10-19T08:22:48.131462Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
total_rows not_matches_line_id not_matches_wavelength not_matches_f_ul not_matches_f_lu not_matches_nu not_matches_B_lu not_matches_B_ul not_matches_A_ul
atomic_number ion_number
107474740074747474
2017417417100171171171171
16767610061616161
3037018740505040505050
1135470000000
403980000000
1185310000000
22780000000
5087220000000
143110000000
2100130000000
60585585585583584585585585585
1156123111131126111131131131
2847474757574757575
3200180880888
70109310821082108110821082108210821082
1427415415415414415415415415
2651313131313131313
3404260000000
422960000000
524120000000
808543990000000
113761260220222
2939292929292929292
3272727272727272727
4459250000000
5214550000000
90506474474473471474474474474
1867171717171717171
2446430430430430430430430430
3250247247249249247249249249
4582727272727272727
100436134134134134134134134134
1852799799799798799799799799
2503737373737373737
3444444444444444444
41032117171717171717
54920000000
110342305100010101010
11711710000000
23533530000000
31101100000000
4112106106106105106106106106
53753750000000
120375371325324325325325325325
15165160000000
27047040000000
31691690000000
41321320000000
51801800000000
130172171172172172172172172172
1674654438444444438444444444
23423420000000
31421420000000
477770000000
593930000000
14010091002727726723727727727727
1717062626262626262
2293291232232232232232232232
33073070000000
41251250000000
549490000000
150185183121119115121121121121
1299291277276275277277277277
21511510000000
3454536393936393939
42152150000000
5990000000
1603613612442444
1198197186186186186186186186
2444119191919191919
350500000000
441410000000
51501500000000
170363362336336336336336336336
1322320224230230224230230230
24314310000000
31211210000000
443430000000
180630627628626627628628628628
1779778633766779633779766766
2675675020200202020
3656330303030303030
4302729303029303030
190603603300030303030
166660000000
2999857575757575757
357570000000
475750000000
200290629060000000
17527520000000
2176617660000000
31221220000000
491910000000
537370000000
659590000000
71001000000000
84224220000000
210422142210000000
1221522150000000
22172170000000
39429420770777
429290000000
589890000000
641410000000
760600000000
852520000000
220877187710000000
1259725970000000
2228922890000000
31391390000000
43313310000000
560600000000
61191190000000
740400000000
867670000000
230699569950000000
1454545450000000
2530453040000000
39959950000000
43353350000000
53723720000000
632320000000
777770000000
833330000000
240417241720000000
117224172240000000
2212221220000000
3171717170000000
42202200000000
52552550000000
64214210000000
731310000000
867670000000
2501078107699110441044991104410441044
1836283620000000
2584858480000000
36776770000000
46026020000000
5100910090000000
658580000000
797970000000
8550000000
26022905229050000000
121753217530000000
2986098600000000
3355935590000000
4186518650000000
56606600000000
64774770000000
759590000000
81091090000000
270529852980000000
1285328530000000
2224722470000000
3409240920000000
4354235420000000
5190719070000000
62892890000000
72342340000000
848480000000
280267126710000000
117150171500000000
2545654560000000
3271227120000000
4473347330000000
61741740000000
71531530000000
866660000000
2902532530000000
116401639555555555555555555555
30098980000000
1660000000
2427426240240240240240240240
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "atom_data_a.to_hdf('A.h5')" + "atc.key_diff(\"lines\")" ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2022-09-30T14:56:28.398117Z", + "start_time": "2022-09-30T14:56:28.339229Z" + } + }, "source": [ - "For the second atomic file we grab species `H-C` from GFALL and `C` from Chianti." + "One can also investigate specific ions:" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 8, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:23:03.924742Z", + "start_time": "2022-10-19T08:23:03.262672Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
pct_change_wavelength pct_change_f_ul pct_change_f_lu pct_change_nu pct_change_B_lu pct_change_B_ul pct_change_A_ul
level_number_lower level_number_upper
010.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
30.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
40.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
60.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
90.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
110.0000010.0000000.000000-0.0000010.0000010.000001-0.000002
160.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
180.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
150.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
70.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
100.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
120.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
170.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
190.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
240.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
60.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
90.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
110.0000010.0000000.000000-0.0000010.0000020.000002-0.000003
160.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
180.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
350.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
70.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
80.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
100.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
120.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
130.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
170.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
190.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
200.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
4100.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
120.0000010.0000000.000000-0.0000010.0000010.000001-0.000002
170.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
190.0000010.0000000.000000-0.0000010.0000010.000001-0.000002
590.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
110.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
160.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
180.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
6100.0000020.0000000.000000-0.0000020.0000020.000002-0.000005
120.0000010.0000000.000000-0.0000010.0000010.000001-0.000002
130.0000010.0000000.000000-0.0000010.0000010.000001-0.000002
170.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
190.0000010.0000000.000000-0.0000010.0000020.000002-0.000003
200.0000010.0000000.000000-0.0000010.0000020.000002-0.000003
790.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
110.0000010.0000000.000000-0.0000010.0000010.000001-0.000002
140.0000010.0000000.000000-0.0000010.0000010.000001-0.000002
160.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
180.0000010.0000000.000000-0.0000010.0000020.000002-0.000003
210.0000010.0000000.000000-0.0000010.0000020.000002-0.000003
8110.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
140.0000020.0000000.000000-0.0000020.0000020.000002-0.000003
150.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
180.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
210.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
220.0000020.0000000.000000-0.0000020.0000020.000002-0.000005
9170.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
190.0000010.0000000.000000-0.0000010.0000010.000001-0.000002
1016-0.0000000.0000000.0000000.000000-0.000000-0.0000000.000001
18-0.0000000.0000000.0000000.000000-0.000000-0.0000000.000001
11170.0000030.0000000.000000-0.0000030.0000030.000003-0.000006
190.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
200.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
12160.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
180.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
210.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
13180.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
210.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
220.0000040.0000000.000000-0.0000040.0000040.000004-0.000008
14190.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
200.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
230.0000040.0000000.000000-0.0000040.0000040.000004-0.000008
15200.0000020.0000000.000000-0.0000020.0000020.000002-0.000004
230.0000040.0000000.000000-0.0000040.0000040.000004-0.000008
240.0000010.0000000.000000-0.0000010.0000010.000001-0.000003
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "chianti_reader = ChiantiReader(ions='C', collisions=True, priority=20)" + "atc.ion_diff(\"lines\",(1,0))" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 10, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:23:13.807434Z", + "start_time": "2022-10-19T08:23:13.777754Z" + }, + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
pct_change_energy pct_change_g
level_number
57-0.0000000.000000
58-0.000000-0.333333
59-0.0000130.000000
60-0.000013-0.250000
61-0.0058222.000000
62-0.0058221.000000
63-0.0044620.000000
64-0.0044620.000000
65-0.0035120.000000
66-0.0035120.000000
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "atom_data_b = TARDISAtomData(atomic_weights,\n", - " ionization_energies,\n", - " gfall_reader,\n", - " zeta_data,\n", - " chianti_reader)" + "atc.ion_diff(\"levels\",(3,0))" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 11, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:23:19.442031Z", + "start_time": "2022-10-19T08:23:19.425469Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "All the values in both the dataframes match.\n" + ] + } + ], "source": [ - "atom_data_b.to_hdf('B.h5')" + "atc.ion_diff(\"levels\",(1,0))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Define the following functions to compare both dataframes." + "Both the `ion_diff` and `key_diff` methods allow displaying detailed information:" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:23:25.414894Z", + "start_time": "2022-10-19T08:23:24.662887Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
line_id_1 line_id_2 matches_line_id wavelength_1 wavelength_2 matches_wavelength pct_change_wavelength f_ul_1 f_ul_2 matches_f_ul pct_change_f_ul f_lu_1 f_lu_2 matches_f_lu pct_change_f_lu nu_1 nu_2 matches_nu pct_change_nu B_lu_1 B_lu_2 matches_B_lu pct_change_B_lu B_ul_1 B_ul_2 matches_B_ul pct_change_B_ul A_ul_1 A_ul_2 matches_A_ul pct_change_A_ul
level_number_lower level_number_upper
01533125533089False1215.6740001215.676000False0.0000020.1390000.139000True0.0000000.1390000.139000True0.0000002466059634408567.0000002466055577308427.000000False-0.0000022837052905.3216152837057778.838667False0.0000022837052905.3216152837057778.838667False0.000002627368588.243199627366525.048786False-0.000003
3533126533090False1215.6680001215.670000False0.0000020.1387500.138750True0.0000000.2775000.277500True0.0000002466071805789080.5000002466067748648893.000000False-0.0000025663872629.9928675663882359.494301False0.0000022831936314.9964332831941179.747150False0.000002626246409.178241626244349.664110False-0.000003
4533127533091False1025.7230001025.725000False0.0000020.0263500.026350True0.0000000.0263500.026350True0.0000002922742865276493.0000002922737166394501.000000False-0.000002453780907.571722453781825.332716False0.000002453780907.571722453781825.332716False0.000002167056223.131353167055571.950010False-0.000004
6533128533092False1025.7220001025.724000False0.0000020.0262500.026250True0.0000000.0525000.052500True0.0000002922745714725822.0000002922740015832719.000000False-0.000002904116676.336302904118504.892298False0.000002452058338.168151452059252.446149False0.000002166422558.167649166421909.455684False-0.000004
9533129533093False972.537000972.539000False0.0000020.0096500.009650True0.0000000.0096500.009650True0.0000003082581516178818.5000003082575176933778.000000False-0.000002157568337.295176157568672.775322False0.000002157568337.295176157568672.775322False0.00000268054566.84878268054287.060014False-0.000004
11533130533094False972.537000972.538000False0.0000010.0096750.009675True0.0000000.0193500.019350True0.0000003082581516178818.5000003082578346553039.000000False-0.000001315953090.845768315953438.669138False0.000001157976545.422884157976719.334569False0.00000168230874.01678468230733.817751False-0.000002
16533131533095False949.743000949.745000False0.0000020.0046500.004650True0.0000000.0046500.004650True0.0000003156564017844827.0000003156557370662651.000000False-0.00000274147166.63842374147328.165407False0.00000274147166.63842374147328.165407False0.00000234386104.36904034385959.605169False-0.000004
18533132533096False949.743000949.745000False0.0000020.0046500.004650True0.0000000.0093000.009300True0.0000003156564017844827.0000003156557370662651.000000False-0.000002148294333.276846148294656.330815False0.00000274147166.63842374147328.165407False0.00000234386104.36904034385959.605169False-0.000004
15533139533103False6564.5640006564.576000False0.0000020.0136000.013600True0.0000000.0136000.013600True0.000000456682969348764.000000456682134535421.562500False-0.0000021498926373.5299001498929222.431827False0.0000021498926373.5299001498929222.431827False0.0000022105083.6667982105075.974226False-0.000004
7533140533104False6564.5230006564.536000False0.0000020.3475000.347500True0.0000000.6950000.695000True0.000000456685821650712.437500456684917258432.187500False-0.00000276599067880.04252676599225135.918060False0.00000238299533940.02126338299612567.959030False0.00000253788655.28660953788442.338812False-0.000004
10533141533105False4862.6460004862.656000False0.0000020.0030450.003045True0.0000000.0030450.003045True0.000000616521247896721.250000616519980027375.875000False-0.000002248596755.947285248597285.240945False0.000002248596755.947285248597285.240945False0.000002858982.300974858978.769462False-0.000004
12533142533106False4862.6370004862.645000False0.0000020.0610000.061000True0.0000000.1220000.122000True0.000000616522388983590.625000616521374683942.500000False-0.0000029960179997.2670809960197107.159893False0.0000024980089998.6335404980098553.579947False0.00000217207919.31715317207862.725677False-0.000003
17533143533107False4341.6510004341.659000False0.0000020.0012150.001215True0.0000000.0012150.001215True0.000000690503354599437.000000690502082268552.125000False-0.00000288565931.34996188566100.975759False0.00000288565931.34996188566100.975759False0.000002429940.823970429939.240273False-0.000004
19533144533108False4341.6470004341.655000False0.0000020.0222000.022200True0.0000000.0444000.044400True0.000000690503990766637.500000690502718433408.375000False-0.0000023236480435.4334433236486634.104351False0.0000021618240217.7167211618243317.052176False0.0000027855723.3575077855694.420734False-0.000004
24533133533097False6564.5840006564.596000False0.0000020.1450000.145000True0.0000000.1450000.145000True0.000000456681577994888.875000456680743186633.187500False-0.00000215981248995.31429515981279369.639841False0.00000215981248995.31429515981279369.639841False0.00000222443769.98428122443687.968639False-0.000004
6533134533098False6564.5380006564.549000False0.0000020.1450000.145000True0.0000000.2900000.290000True0.000000456684778121476.312500456684012869734.062500False-0.00000231962274019.86249531962329899.567265False0.00000215981137009.93124815981164949.783632False0.00000222444084.52798222444009.348558False-0.000003
9533135533099False4862.6560004862.664000False0.0000020.0342500.034250True0.0000000.0342500.034250True0.000000616519980027376.000000616518965735654.250000False-0.0000022796208998.7136062796213802.106439False0.0000022796208998.7136062796213802.106439False0.0000029661748.0473129661716.272963False-0.000003
11533136533100False4862.6450004862.652000False0.0000010.0342500.034250True0.0000000.0685000.068500True0.000000616521374683942.500000616520487174488.250000False-0.0000015592405346.6047055592413803.314594False0.0000022796202673.3023522796206901.657297False0.0000029661791.7598809661763.959180False-0.000003
16533137533101False4341.6580004341.665000False0.0000020.0140000.014000True0.0000000.0140000.014000True0.000000690502241309656.250000690501128023465.500000False-0.0000021020514434.5801091020516154.064373False0.0000021020514434.5801091020516154.064373False0.0000024954034.6718814954018.705686False-0.000003
18533138533102False4341.6540004341.661000False0.0000020.0139750.013975True0.0000000.0279500.027950True0.000000690502877474805.500000690501764186563.500000False-0.0000022037382297.6946572037385730.522034False0.0000021018691148.8473291018692865.261017False0.0000024945197.2934814945181.355753False-0.000003
35533145533109False6564.7220006564.734000False0.0000020.0272000.027200True0.0000000.0136000.013600True0.000000456671977884212.000000456671143111053.562500False-0.0000021498962450.6200191498965299.524566False0.0000022997924901.2400372997930599.049132False0.0000024209964.6750734209949.291040False-0.000004
7533146533110False6564.6800006564.694000False0.0000020.0697500.069750True0.0000000.0697500.069750True0.000000456674899614299.500000456673925700116.312500False-0.0000027687644266.2055197687661219.434911False0.0000027687644266.2055197687661219.434911False0.00000210795911.52598010795865.497218False-0.000004
8533147533111False6564.6650006564.677000False0.0000020.4183330.418333True0.0000000.6275000.627500True0.000000456675943098391.125000456675108310736.312500False-0.00000269161086084.97810469161217532.552353False0.00000246107390723.31873346107478355.034904False0.00000264749968.37484264749731.763761False-0.000004
10533148533112False4862.7330004862.743000False0.0000020.0061000.006100True0.0000000.0030500.003050True0.000000616510217608081.500000616508949784103.125000False-0.000002249009415.871731249009946.034833False0.000002498018831.743461498019892.069666False0.0000021720723.9886901720716.914448False-0.000004
12533149533113False4862.7230004862.732000False0.0000020.0121750.012175True0.0000000.0121750.012175True0.000000616511485437274.500000616510344390766.250000False-0.000002993994558.590085993996470.485633False0.000002993994558.590085993996470.485633False0.0000023434409.9553023434397.248261False-0.000004
13533150533114False4862.7200004862.729000False0.0000020.0730000.073000True0.0000000.1095000.109500True0.000000616511865787049.250000616510724739132.875000False-0.0000028939822342.2232388939839537.505178False0.0000025959881561.4821595959893025.003451False0.00000220592380.78726320592304.597061False-0.000004
17533151533115False4341.7200004341.729000False0.0000020.0024300.002430True0.0000000.0012150.001215True0.000000690492380899735.500000690490949573315.000000False-0.00000288567338.89037988567528.915417False0.000002177134677.780758177135057.830834False0.000002859854.317131859850.753800False-0.000004
19533152533116False4341.7160004341.724000False0.0000020.0044500.004450True0.0000000.0044500.004450True0.000000690493017046715.875000690491744753927.125000False-0.000002324382135.767537324382757.031099False0.000002324382135.767537324382757.031099False0.0000021574633.2352391574627.435127False-0.000004
20533153533117False4341.7150004341.723000False0.0000020.0266670.026667True0.0000000.0400000.040000True0.000000690493176083644.375000690491903790269.375000False-0.0000022915793807.2328102915799391.624333False0.0000021943862538.1552071943866261.082889False0.0000029436008.7526009435973.995347False-0.000004
410533158533122False18755.94800018755.988000False0.0000020.0322500.032250True0.0000000.0322500.032250True0.000000159838605865190.062500159838264985027.687500False-0.00000210155568618.19911210155591014.159319False0.00000210155568618.19911210155591014.159319False0.000002611496.401547611493.794371False-0.000004
12533159533123False18755.80400018755.822000False0.0000010.3100000.310000True0.0000000.6200000.620000True0.000000159839833045813.437500159839679647205.000000False-0.000001195237339592.654419195237541142.933655False0.00000197618669796.32720997618770571.466827False0.0000015878040.1640655878028.891728False-0.000002
17533160533124False12821.46600012821.486000False0.0000020.0074500.007450True0.0000000.0074500.007450True0.000000233820733136132.781250233820368403475.187500False-0.0000021603723391.3339711603726009.437804False0.0000021603723391.3339711603726009.437804False0.000002302289.546749302288.604192False-0.000003
19533161533125False12821.43200012821.448000False0.0000010.0697500.069750True0.0000000.1395000.139500True0.000000233821353184262.062500233821061396497.437500False-0.00000130029371789.43800730029411444.494228False0.00000115014685894.71900415014705722.247114False0.0000012830175.5316932830168.472905False-0.000002
59533154533118False18756.00100018756.043000False0.0000020.1615000.161500True0.0000000.1615000.161500True0.000000159838154199288.000000159837796277178.468750False-0.00000250856712138.09957950856829714.503868False0.00000250856712138.09957950856829714.503868False0.0000023062204.9837193062191.274681False-0.000004
11533155533119False18755.84200018755.877000False0.0000020.1617500.161750True0.0000000.3235000.323500True0.000000159839509204652.031250159839210931059.062500False-0.000002101870011808.740829101870209305.872345False0.00000250935005904.37041550935104652.936172False0.0000023066997.2385223066985.797211False-0.000004
16533156533120False12821.48800012821.513000False0.0000020.0403500.040350True0.0000000.0403500.040350True0.000000233820331930272.062500233819876016192.406250False-0.0000028685953003.3342788685970570.531132False0.0000028685953003.3342788685970570.531132False0.0000021637227.0272661637220.645368False-0.000004
18533157533121False12821.45000012821.474000False0.0000020.0402500.040250True0.0000000.0805000.080500True0.000000233821024923078.093750233820587242933.187500False-0.00000217328801597.03298217328835292.801041False0.0000028664400798.5164918664417646.400520False0.0000021633179.1441171633173.032734False-0.000004
610533162533126False18756.32800018756.373000False0.0000020.0645000.064500True0.0000000.0322500.032250True0.000000159835367562350.125000159834984087808.437500False-0.00000210155774372.45237410155799475.720526False0.00000220311548744.90474720311598951.441051False0.0000021222943.2483461222937.382299False-0.000005
12533163533127False18756.18400018756.207000False0.0000010.0617500.061750True0.0000000.0617500.061750True0.000000159836594693248.843750159836398691910.343750False-0.00000119445403189.12892919445428446.646748False0.00000119445403189.12892919445428446.646748False0.0000011170820.2348001170817.365330False-0.000002
13533164533128False18756.13100018756.152000False0.0000010.3716670.371667True0.0000000.5575000.557500True0.000000159837046350337.375000159836867391563.031250False-0.000001175559216917.893555175559426231.121490False0.000001117039477945.262360117039617487.414322False0.0000017047081.9952857047066.226986False-0.000002
17533165533129False12821.64400012821.667000False0.0000020.0148500.014850True0.0000000.0074250.007425True0.000000233817487055482.125000233817067624670.000000False-0.0000021598363958.9427631598366942.246820False0.0000023196727917.8855253196733884.493641False0.000002602533.574569602531.413900False-0.000004
19533166533130False12821.60900012821.628000False0.0000010.0139250.013925True0.0000000.0139250.013925True0.000000233818125322648.656250233817778834325.812500False-0.0000012997596952.3815732997601612.161328False0.0000022997596952.3815732997601612.161328False0.000002565005.106596565003.433028False-0.000003
20533167533131False12821.59600012821.615000False0.0000010.0836670.083667True0.0000000.1255000.125500True0.000000233818362394198.031250233818015905172.593750False-0.00000127016016954.49229827016058951.069077False0.00000218010677969.66153318010705967.379383False0.0000023394771.2587653394761.203306False-0.000003
79533168533132False18756.34200018756.373000False0.0000020.0183500.018350True0.0000000.0091750.009175True0.000000159835248258962.218750159834984087808.437500False-0.0000022889280602.0962092889285587.278631False0.0000025778561204.1924175778571174.557261False0.000002347922.094676347920.945197False-0.000003
11533169533133False18756.18400018756.207000False0.0000010.0018320.001832True0.0000000.0018320.001832True0.000000159836594693248.843750159836398691910.343750False-0.000001577063989.377794577064738.922756False0.000001577063989.377794577064738.922756False0.00000134745.39401234745.308858False-0.000002
14533170533134False18756.13100018756.152000False0.0000010.6783330.678333True0.0000001.0175001.017500True0.000000159837046350337.375000159836867391563.031250False-0.000001320415252401.716064320415634421.822632False0.000001213610168267.810699213610422947.881744False0.00000112861714.67300912861685.894095False-0.000002
16533171533135False12821.64700012821.667000False0.0000020.0036850.003685True0.0000000.0018420.001842True0.000000233817432347029.937500233817067624670.000000False-0.000002396631149.281868396631796.779767False0.000002793262298.563737793263593.559533False0.000002149517.520758149517.054560False-0.000003
18533172533136False12821.60900012821.628000False0.0000010.0003670.000367True0.0000000.0003670.000367True0.000000233818125322648.656250233817778834325.812500False-0.00000179110727.46859879110850.446628False0.00000279110727.46859879110850.446628False0.00000214911.26582914911.221662False-0.000003
21533173533137False12821.59600012821.615000False0.0000010.1045000.104500True0.0000000.1567500.156750True0.000000233818362394198.031250233818015905172.593750False-0.00000133743112809.69456133743165263.586277False0.00000222495408539.79637522495443509.057514False0.0000024240082.8271834240070.267874False-0.000003
811533174533138False18756.31000018756.344000False0.0000020.0165000.016500True0.0000000.0110000.011000True0.000000159835520952682.000000159835231215635.593750False-0.0000023463981732.9668543463988263.802550False0.0000025195972599.4502805195982395.703824False0.000002312846.547714312845.414040False-0.000004
14533175533139False18756.25800018756.289000False0.0000020.0485000.048500True0.0000000.0485000.048500True0.000000159835964081961.343750159835699908441.343750False-0.00000215272968025.18215915272994377.367657False0.00000215272968025.18215915272994377.367657False0.000002919584.345215919581.307041False-0.000003
15533176533140False18756.22900018756.262000False0.0000020.7275000.727500True0.0000000.9700000.970000True0.000000159836211212818.968750159835929995006.437500False-0.000002305458888217.462585305459447832.601318False0.000002229094166163.096924229094585874.450989False0.00000213793807.83280313793759.318299False-0.000004
18533177533141False12821.66800012821.692000False0.0000020.0033250.003325True0.0000000.0022170.002217True0.000000233817049388581.875000233816611723320.125000False-0.000002477178012.252622477178940.107694False0.000002715767018.378934715768410.161542False0.000002134910.211132134909.706304False-0.000004
21533178533142False12821.65500012821.680000False0.0000020.0074670.007467True0.0000000.0074670.007467True0.000000233817286457949.437500233816830555746.125000False-0.0000021607334832.6322921607338083.399690False0.0000021607334832.6322921607338083.399690False0.000002302956.877935302955.697027False-0.000004
22533179533143False12821.64900012821.680000False0.0000020.1120000.112000True0.0000000.1493330.149333True0.000000233817395874742.812500233816830555746.125000False-0.00000232146681609.33200832146761667.993801False0.00000224110011206.99900424110071250.995354False0.0000024544357.4221634544335.455401False-0.000005
917533182533146False40522.21800040522.305000False0.0000020.0530000.053000True0.0000000.0530000.053000True0.00000073982243025295.40625073982084187955.234375False-0.00000236058244909.47763836058324944.436989False0.00000236058244909.47763836058324944.436989False0.000002215293.877258215292.953168False-0.000004
19533183533147False40521.87300040521.922000False0.0000010.3050000.305000True0.0000000.6100000.610000True0.00000073982872904221.37500073982783442503.046875False-0.000001415006455248.867004415006987227.073730False0.000001207503227624.433502207503493613.536865False0.0000011238976.4282131238973.433926False-0.000002
1016533180533144False40522.31600040522.305000False-0.0000000.1815000.181500True0.0000000.1815000.181500True0.00000073982064105121.73437573982084187955.234375False0.000000123482778842.156128123482754290.854965False-0.000000123482778842.156128123482754290.854965False-0.000000737276.409790737276.811319False0.000001
18533181533145False40521.93900040521.922000False-0.0000000.1815000.181500True0.0000000.3630000.363000True0.00000073982752404814.57812573982783442503.046875False0.000000246963260036.387970246963174366.275055False-0.000000123481630018.193985123481587183.137527False-0.000000737290.128507737290.748385False0.000001
1117533184533148False40522.95700040523.074000False0.0000030.1060000.106000True0.0000000.0530000.053000True0.00000073980893842470.56250073980680241582.843750False-0.00000336058902500.40684536059009230.582169False0.00000372117805000.81369072118018461.164337False0.000003430572.049766430569.564168False-0.000006
19533185533149False40522.61200040522.691000False0.0000020.0610000.061000True0.0000000.0610000.061000True0.00000073981523698423.00000073981379469591.484375False-0.00000241501402374.82408141501486297.327301False0.00000241501402374.82408141501486297.327301False0.000002247786.247773247785.282064False-0.000004
20533186533150False40522.48100040522.562000False0.0000020.3650000.365000True0.0000000.5475000.547500True0.00000073981762863927.29687573981614982784.156250False-0.000002372490890906.855286372491662530.036926False0.000002248327260604.570190248327775020.024567False0.0000021482665.0031941482659.078363False-0.000004
1216533187533151False40522.99000040523.074000False0.0000020.0464000.046400True0.0000000.0232000.023200True0.00000073980833595941.46875073980680241582.843750False-0.00000215784287156.03928215784321021.688795False0.00000231568574312.07856431568642043.377590False0.000002188476.514811188475.733749False-0.000004
18533188533152False40522.61200040522.691000False0.0000020.0046500.004650True0.0000000.0046500.004650True0.00000073981523698423.00000073981379469591.484375False-0.0000023163631492.5070813163637889.878229False0.0000023163631492.5070813163637889.878229False0.00000218888.62380618888.550190False-0.000004
21533189533153False40522.48100040522.562000False0.0000020.5933330.593333True0.0000000.8900000.890000True0.00000073981762863927.29687573981614982784.156250False-0.000002605510306679.636963605511561007.731201False0.000002403673537786.424683403674374005.154175False0.0000022410176.9001702410167.268936False-0.000004
1318533190533154False40522.85800040522.945000False0.0000020.0417500.041750True0.0000000.0278330.027833True0.00000073981074582646.65625073980915750323.656250False-0.00000218936547188.24468618936589219.204178False0.00000228404820782.36703128404883828.806267False0.000002169589.348234169588.620329False-0.000004
21533191533155False40522.72700040522.816000False0.0000020.0425000.042500True0.0000000.0425000.042500True0.00000073981313745247.20312573981151260563.921875False-0.00000228914993548.91095028915059155.014347False0.00000228914993548.91095028915059155.014347False0.000002172636.979652172636.221623False-0.000004
22533192533156False40522.66100040522.816000False0.0000040.6362500.636250True0.0000000.8483330.848333True0.00000073981434239967.59375073981151260563.921875False-0.000004577165009623.355591577167259211.854858False0.000004432873757217.516663432875444408.891174False0.0000042584485.5553322584465.788419False-0.000008
1419533193533157False40522.85800040522.945000False0.0000020.0124250.012425True0.0000000.0082830.008283True0.00000073981074582646.65625073980915750323.656250False-0.0000025635607157.2201255635619665.835015False0.0000028453410735.8301878453429498.752523False0.00000250470.60243850470.385811False-0.000004
20533194533158False40522.72700040522.816000False0.0000020.0005920.000592True0.0000000.0005920.000592True0.00000073981313745247.20312573981151260563.921875False-0.000002402542067.053466402542980.393337False0.000002402542067.053466402542980.393337False0.0000022403.3775602403.367007False-0.000004
23533195533159False40522.66100040522.816000False0.0000040.9425000.942500True0.0000001.2566671.256667True0.00000073981434239967.59375073981151260563.921875False-0.000004854975279481.355713854978611877.678955False0.000004641231459611.016846641233958908.259277False0.0000043828491.3727313828462.091292False-0.000008
1520533196533160False40522.85800040522.945000False0.0000020.0118330.011833True0.0000000.0088750.008875True0.00000073981074582646.65625073980915750323.656250False-0.0000026038150525.5929906038163927.680373False0.0000028050867367.4573218050885236.907165False0.00000248067.24041848067.034105False-0.000004
23533197533161False40522.79300040522.945000False0.0000040.0673750.067375True0.0000000.0673750.067375True0.00000073981193250919.28125073980915750323.656250False-0.00000445838843843.21233445839019112.953827False0.00000445838843843.21233445839019112.953827False0.000004273679.496838273677.444184False-0.000008
24533198533162False40522.76000040522.816000False0.0000011.0800001.080000True0.0000001.3500001.350000True0.00000073981253498034.18750073981151260563.921875False-0.000001918477013639.626953918478349629.867432False0.000001734781610911.701538734782679703.893921False0.0000014387003.1612664386991.043602False-0.000003
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "atc.ion_diff(\"lines\",(1,0), simplify_output=False)" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "import pandas as pd\n", - "from carsus.util import parse_selected_species" + "But these complex dataframes can also be represented in smaller formats:" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:23:26.515926Z", + "start_time": "2022-10-19T08:23:26.465650Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
total_rowsmatches_line_idmatches_wavelengthmatches_f_ulmatches_f_lumatches_numatches_B_lumatches_B_ulmatches_A_ul
values174031741743333
\n", + "
" + ], + "text/plain": [ + " total_rows matches_line_id matches_wavelength matches_f_ul \\\n", + "values 174 0 3 174 \n", + "\n", + " matches_f_lu matches_nu matches_B_lu matches_B_ul matches_A_ul \n", + "values 174 3 3 3 3 " + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "atc.ion_diff(\"lines\",\"He\",return_summary=True)" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "def highlight_values(val):\n", - " if val == True:\n", - " return 'background-color: #BCF5A9'\n", - " else:\n", - " return 'background-color: #F5A9A9'\n", - " \n", - "def highlight_diff(val):\n", - " if val == 0:\n", - " return 'background-color: #BCF5A9'\n", - " else:\n", - " return 'background-color: #F5A9A9'" + "Specific columns can be plotted:" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 14, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:23:28.965585Z", + "start_time": "2022-10-19T08:23:28.526202Z" + }, + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[\u001b[1m py.warnings\u001b[0m][\u001b[1;33mWARNING\u001b[0m] - /home/atharva/workspace/code/tardis-main/carsus/carsus/io/atom_data_compare.py:189: PerformanceWarning: indexing past lexsort depth may impact performance.\n", + " df1 = df1.loc[parsed_ion]\n", + " (\u001b[1mwarnings.py\u001b[0m:110)\n", + "[\u001b[1m py.warnings\u001b[0m][\u001b[1;33mWARNING\u001b[0m] - /home/atharva/workspace/code/tardis-main/carsus/carsus/io/atom_data_compare.py:190: PerformanceWarning: indexing past lexsort depth may impact performance.\n", + " df2 = df2.loc[parsed_ion]\n", + " (\u001b[1mwarnings.py\u001b[0m:110)\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEVCAYAAADkckIIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAW3UlEQVR4nO3dfbRddX3n8fdnElBQJCrBIiEGXfGBOj5ARKwPA2WsgO2kzjCzsFpbRptSRa2tWjrTVmdcHXXsdFpbNIOWKssHlg8Uoo2i4xO0ik0iAQmIk4LABTtEBRRRIfKdP/ZO5+zLvck9956He27er7XOytl7/87e399Ocj937332/qWqkCRpj38x7gIkSYuLwSBJ6jAYJEkdBoMkqcNgkCR1GAySpI4lEQxJzk9ye5Jr5tj+PyS5NsmOJB8adn2SNEmyFO5jSPI84G7ggqp68j7argU+Avx8Vd2R5PCqun0UdUrSJFgSRwxVdRnwvd55SR6X5NNJtiW5PMkT20W/AZxbVXe0nzUUJKnHkgiGWZwHvLqqjgNeD7yrnf944PFJ/j7JFUlOGVuFkrQILR93AcOQ5KHAzwEfTbJn9oPaP5cDa4ETgVXA5UmeXFV3jrhMSVqUlmQw0BwJ3VlVT5th2RRwRVXdB9yY5HqaoNgywvokadFakqeSqur7ND/0/z1AGk9tF18MnNTOP4zm1NIN46hTkhajJREMST4MfAV4QpKpJC8HXgK8PMlVwA5gfdv8UuC7Sa4FvgC8oaq+O466JWkxWhJfV5UkDc6SOGKQJA3OxF98Puyww2rNmjXjLk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1TVze3D544DtjQP7eQg4PZp2zx5ljaX0Tzie3tPbWuAw4BLqupHAEk+sZf+zPR5kjwW+M/AoVV1ek/7F9A8WG3XBOwHgOcsZF8k+WWaUcsOB86tpTPo0n7HYNDQVNV9Sb5F88Pxy8DVwEnA44DrkpwI/GvgWVV1T5Iv0jy/HprxKE4HfoZm+EtoBkZ5f1X9/l42O2ObNKOH/aRn1k9pfljONNjKbGb6PFV1A/Dy9kmxe7Z3MM2Y3XvGJPgWi3s/7PnMXD1gHVV1MXBxmgGY/gQwGCaU1xg0bJfRnI64jOY0ylnA9qoq4FCa34LvSfJEmlMue1xI8yz702l+OEIzbvTpSQ4HSPKIJI+Ztr25tOn1d8AvJXlwmlHGXtjO/wHN6ZT5Ogn4Qs/0Yt8PMLh98QfAuX201yJjMGjYLgeOAL5SVf8X+HE7D+DTwPIkVwNvoefbO9WMUXAIcGs1A9xQVdfS/ND5TPuZz7brpudz+2wzrf0WmgFXrgIuArbSDLjyXeDvk1zTc8G1H6e2/ZuI/dB+ZkH7Io23A5+qqq/tbVta3ByPQfu9JA+tqrvb0z+XARv6+cGW5JHAHwPPB95bVW9N8jXgmVV133CqHo6F7Iv2m1e/RjNK3fZqBrPRBDIYtN9L8iHgGJrz+u+vqreOuaSxcV8IDAZJ0jReY5AkdRgMkqQOg0GS1GEwSJI6DAZJUofBIEnqMBgkSR3/DzSC3RDm7BCnAAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], "source": [ - "def compare_levels_lines(path_a, path_b, ions='H-Zn'):\n", - " \n", - " # Read data\n", - " levels_a = pd.read_hdf(path_a, key='levels_data')\n", - " levels_b = pd.read_hdf(path_b, key='levels_data')\n", - " lines_a = pd.read_hdf(path_a, key='lines_data')\n", - " lines_b = pd.read_hdf(path_b, key='lines_data')\n", - " \n", - " # Get ions list\n", - " ions = parse_selected_species(ions)\n", - " \n", - " lvl_eq = []\n", - " lns_eq = []\n", - " for ion in ions:\n", - " \n", - " # How many levels per ion in A\n", - " try:\n", - " num_lvl_a = len(levels_a.loc[ion])\n", - " \n", - " except (KeyError, TypeError, ValueError):\n", - " num_lvl_a = 0\n", - " \n", - " # How many levels per ion in B\n", - " try:\n", - " num_lvl_b = len(levels_b.loc[ion])\n", - " \n", - " except (KeyError, TypeError, ValueError):\n", - " num_lvl_b = 0\n", - "\n", - " # If level number is the same in A and B (and not zero) \n", - " # then compare cell against cell. `True` means all cells \n", - " # are equal in both dataframes.\n", - " if num_lvl_a == num_lvl_b:\n", - " val_lvl = True\n", - " \n", - " if num_lvl_a != 0:\n", - " try:\n", - " k = levels_a.loc[ion].eq(levels_b.loc[ion]).sum().sum()\n", - " if num_lvl_a*3 != k: # x3 because this df has three columns!\n", - " val_lvl = False\n", - " \n", - " except (KeyError, TypeError, ValueError):\n", - " pass\n", - "\n", - " else:\n", - " val_lvl = False\n", - " \n", - " # Append the results\n", - " lvl_eq.append((ion, num_lvl_a, num_lvl_b, val_lvl))\n", - " \n", - " \n", - " # Same for lines\n", - " try:\n", - " num_lns_a = len(lines_a.loc[ion])\n", - " \n", - " except (KeyError, TypeError, ValueError):\n", - " num_lns_a = 0\n", - " \n", - " try:\n", - " num_lns_b = len(lines_b.loc[ion])\n", - " \n", - " except (KeyError, TypeError, ValueError):\n", - " num_lns_b = 0\n", - "\n", - " if num_lns_a == num_lns_b:\n", - " val_lns = True\n", - " \n", - " if num_lns_a != 0:\n", - " try:\n", - " k = lines_a.loc[ion].eq(lines_b.loc[ion]).sum().sum()\n", - " if num_lns_a*8 != k:\n", - " val_lvl = False\n", - " \n", - " except (KeyError, TypeError, ValueError):\n", - " pass\n", - " \n", - " else:\n", - " val_lns = False\n", - " \n", - " lns_eq.append((ion, num_lns_a, num_lns_b, val_lns))\n", - " \n", - " df_lvl = pd.DataFrame(lvl_eq, columns=['ion', 'num_lvl_a', 'num_lvl_b', 'val_lvl'])\n", - " df_lns = pd.DataFrame(lns_eq, columns=['ion', 'num_lns_a', 'num_lns_b', 'val_lns'])\n", - " df = pd.merge(df_lvl, df_lns).set_index('ion')\n", - " \n", - " df['diff_lvl'] = abs(df['num_lvl_b'] - df['num_lvl_a'])\n", - " df['diff_lns'] = abs(df['num_lns_b'] - df['num_lns_a'])\n", - " df = df[['num_lvl_a', 'num_lvl_b', 'diff_lvl', 'val_lvl', \n", - " 'num_lns_a', 'num_lns_b', 'diff_lns', 'val_lns']]\n", - "\n", - " return df" + "atc.plot_ion_diff(key_name=\"lines\", ion=\"Fe\", column=\"wavelength\")" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:23:30.380013Z", + "start_time": "2022-10-19T08:23:30.210549Z" + }, + "scrolled": true + }, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAELCAYAAAAY3LtyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAWRUlEQVR4nO3df7DddZ3f8efLANPYRYNydSGQBTsUxKkIm0Xr2gpLlYTuGrbTncJaXV1oSle6bmdkFqYdddbpdLepbccKZiMyrFtHZrabYmoj6dZqcRaxBEECajSCShIrUYyru5lC4rt/nG/wcDn33nO+95zvuTd5PmbO3PP9fD/f7+fN9365r3x/nO9JVSFJUhvPm3YBkqTlyxCRJLVmiEiSWjNEJEmtGSKSpNYMEUlSaydMu4BxOPXUU+uss86adhmStKzcf//936uqmcWs45gIkbPOOoudO3dOuwxJWlaSfGux6/B0liSptU5DJMltSZ5I8vAc89+c5KHmdU+SC7qsT5I0mq6PRG4H1s0z/zHg9VX1SuB9wJYuipIktdPpNZGqujvJWfPMv6dv8l7gjIkXJUlqbSlfWL8G+NS0i5DauPOBfWzasZv9Bw9x+qqV3HD5uVx54epplyWN3ZIMkSSX0guR183TZyOwEWDNm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ngG+eb4zFjqOlo3kY6GuBP0nyIPCH9L73hiT/oLmmMfu1Y4QhbgHurqrPNeu8PM0XYdF7oOutzfQX5lvJuHgkouNeVV2XZB1waVV9b8yrXw/cVVW3TXAMLS3PAw5W1atmz6jeA0K3PmeJISV5DzAD/NO+de4AdjTzbwdur6rPth1jVB6JSGOQ5GVJPpLkv8yadTlw1xjHuTLJh5N8Iskbx7VejU/1njj8WJJfg2e+jvaCBRZbUJJr6e1PV1fVTxa7vnExRKSFHebZ/6/8tdkdqvdtcNf0t6X3xUSrqnkE+JjGubOq/gm9h/z9oyHXqwlK8nHg88C5SfYmuQZ4M3BNkqMPXBz62xaTfA74E+CyZn2XN7M2Ay8FPp9Z3zPfssax8HSWtLDvAi9J8mLgx8AvM9zRxaXAZyY0zr+id51FU1ZVV88xq9UttVX1d+ZoX/DvdVW9bY72uWpcNENEWkBVPZ3k9+h97e5jwFeHXHQ9MPv01qLGab5T4/eBT1Xz3fLSNPkoeGkMmqOHfw28Abi1qv5Nki8Cr66qp8c4zm/T+4Ku+4AHq2rzuNYttWGISJJa83SW1GiOJj49YNZl1fe948tlHKkLHolIklrzFl9JUmuGiCSpNUNEktSaISJJas0QkSS1ZohIklozRCRJrRkikqTW/j/JchuXR1RnhgAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "atc.plot_ion_diff(key_name=\"lines\", ion=(23,0), column=\"f_ul\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Then, the comparison is straightforward:" + "The dataframes are available as attributes as well:" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": { - "scrolled": false + "ExecuteTime": { + "end_time": "2022-10-19T08:23:31.825841Z", + "start_time": "2022-10-19T08:23:31.803467Z" + } }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
line_idwavelengthf_ulf_lunuB_luB_ulA_ul
atomic_numberion_numberlevel_number_lowerlevel_number_upper
302266182416404.8164360.0004580.0003051.827466e+148.411155e+071.261673e+081.135375e+04
2966192527592.0296520.0012270.0008181.086518e+143.790250e+085.685376e+081.075264e+04
3766200043823.9005170.0002760.0002766.840844e+132.030891e+082.030891e+089.586502e+02
3866200243823.9735370.0025170.0016786.840832e+131.234798e+091.852197e+098.742965e+03
4466205067909.4086780.0006190.0006194.414594e+137.061638e+087.061638e+088.958233e+02
....................................
21112153343810126.2490000.5935000.8902502.960548e+141.513548e+111.009032e+113.860697e+07
132153344010126.4990000.0424000.0424002.960475e+147.208762e+097.208762e+092.757969e+06
2253344110126.4360000.6360000.8480002.960493e+141.441743e+111.081308e+114.137005e+07
142353344210126.4360001.0095001.3460002.960493e+142.288428e+111.716321e+116.566521e+07
152453344310126.5230001.0470001.3087502.960468e+142.225115e+111.780092e+116.810331e+07
\n", + "

271771 rows × 8 columns

\n", + "
" + ], + "text/plain": [ + " line_id \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 22 66 1824 \n", + " 29 66 1925 \n", + " 37 66 2000 \n", + " 38 66 2002 \n", + " 44 66 2050 \n", + "... ... \n", + "2 1 11 21 533438 \n", + " 13 21 533440 \n", + " 22 533441 \n", + " 14 23 533442 \n", + " 15 24 533443 \n", + "\n", + " wavelength \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 22 66 16404.816436 \n", + " 29 66 27592.029652 \n", + " 37 66 43823.900517 \n", + " 38 66 43823.973537 \n", + " 44 66 67909.408678 \n", + "... ... \n", + "2 1 11 21 10126.249000 \n", + " 13 21 10126.499000 \n", + " 22 10126.436000 \n", + " 14 23 10126.436000 \n", + " 15 24 10126.523000 \n", + "\n", + " f_ul \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 22 66 0.000458 \n", + " 29 66 0.001227 \n", + " 37 66 0.000276 \n", + " 38 66 0.002517 \n", + " 44 66 0.000619 \n", + "... ... \n", + "2 1 11 21 0.593500 \n", + " 13 21 0.042400 \n", + " 22 0.636000 \n", + " 14 23 1.009500 \n", + " 15 24 1.047000 \n", + "\n", + " f_lu \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 22 66 0.000305 \n", + " 29 66 0.000818 \n", + " 37 66 0.000276 \n", + " 38 66 0.001678 \n", + " 44 66 0.000619 \n", + "... ... \n", + "2 1 11 21 0.890250 \n", + " 13 21 0.042400 \n", + " 22 0.848000 \n", + " 14 23 1.346000 \n", + " 15 24 1.308750 \n", + "\n", + " nu \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 22 66 1.827466e+14 \n", + " 29 66 1.086518e+14 \n", + " 37 66 6.840844e+13 \n", + " 38 66 6.840832e+13 \n", + " 44 66 4.414594e+13 \n", + "... ... \n", + "2 1 11 21 2.960548e+14 \n", + " 13 21 2.960475e+14 \n", + " 22 2.960493e+14 \n", + " 14 23 2.960493e+14 \n", + " 15 24 2.960468e+14 \n", + "\n", + " B_lu \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 22 66 8.411155e+07 \n", + " 29 66 3.790250e+08 \n", + " 37 66 2.030891e+08 \n", + " 38 66 1.234798e+09 \n", + " 44 66 7.061638e+08 \n", + "... ... \n", + "2 1 11 21 1.513548e+11 \n", + " 13 21 7.208762e+09 \n", + " 22 1.441743e+11 \n", + " 14 23 2.288428e+11 \n", + " 15 24 2.225115e+11 \n", + "\n", + " B_ul \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 22 66 1.261673e+08 \n", + " 29 66 5.685376e+08 \n", + " 37 66 2.030891e+08 \n", + " 38 66 1.852197e+09 \n", + " 44 66 7.061638e+08 \n", + "... ... \n", + "2 1 11 21 1.009032e+11 \n", + " 13 21 7.208762e+09 \n", + " 22 1.081308e+11 \n", + " 14 23 1.716321e+11 \n", + " 15 24 1.780092e+11 \n", + "\n", + " A_ul \n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 22 66 1.135375e+04 \n", + " 29 66 1.075264e+04 \n", + " 37 66 9.586502e+02 \n", + " 38 66 8.742965e+03 \n", + " 44 66 8.958233e+02 \n", + "... ... \n", + "2 1 11 21 3.860697e+07 \n", + " 13 21 2.757969e+06 \n", + " 22 4.137005e+07 \n", + " 14 23 6.566521e+07 \n", + " 15 24 6.810331e+07 \n", + "\n", + "[271771 rows x 8 columns]" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "tt = compare_levels_lines('A.h5', 'B.h5', ions='H-C')" + "atc.lines1" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "ExecuteTime": { + "end_time": "2022-10-19T08:23:32.047187Z", + "start_time": "2022-10-19T08:23:32.014781Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
line_idwavelengthf_ulf_lunuB_luB_ulA_ul
atomic_numberion_numberlevel_number_lowerlevel_number_upper
302167182316404.7754250.0005030.0002521.827471e+146.933393e+071.386679e+081.247877e+04
2867192327591.9686350.0013490.0006741.086521e+143.124340e+086.248679e+081.181808e+04
3767200143823.9005170.0027670.0013836.840844e+131.017857e+092.035713e+099.609265e+03
4467205267909.4086780.0062080.0031044.414594e+133.539203e+097.078406e+098.979504e+03
51672107105557.6007280.0117210.0058612.840084e+131.038640e+102.077280e+107.016705e+03
....................................
21112153341010126.2800000.5935000.8902502.960539e+141.513552e+111.009035e+113.860674e+07
132153341210126.5050000.0424000.0424002.960473e+147.208767e+097.208767e+092.757966e+06
2253341310126.4400000.6360000.8480002.960492e+141.441744e+111.081308e+114.137002e+07
142353341410126.4400001.0095001.3460002.960492e+142.288429e+111.716322e+116.566515e+07
152453341510126.5370001.0470001.3087502.960464e+142.225119e+111.780095e+116.810312e+07
\n", + "

271741 rows × 8 columns

\n", + "
" + ], + "text/plain": [ + " line_id \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 21 67 1823 \n", + " 28 67 1923 \n", + " 37 67 2001 \n", + " 44 67 2052 \n", + " 51 67 2107 \n", + "... ... \n", + "2 1 11 21 533410 \n", + " 13 21 533412 \n", + " 22 533413 \n", + " 14 23 533414 \n", + " 15 24 533415 \n", + "\n", + " wavelength \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 21 67 16404.775425 \n", + " 28 67 27591.968635 \n", + " 37 67 43823.900517 \n", + " 44 67 67909.408678 \n", + " 51 67 105557.600728 \n", + "... ... \n", + "2 1 11 21 10126.280000 \n", + " 13 21 10126.505000 \n", + " 22 10126.440000 \n", + " 14 23 10126.440000 \n", + " 15 24 10126.537000 \n", + "\n", + " f_ul \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 21 67 0.000503 \n", + " 28 67 0.001349 \n", + " 37 67 0.002767 \n", + " 44 67 0.006208 \n", + " 51 67 0.011721 \n", + "... ... \n", + "2 1 11 21 0.593500 \n", + " 13 21 0.042400 \n", + " 22 0.636000 \n", + " 14 23 1.009500 \n", + " 15 24 1.047000 \n", + "\n", + " f_lu \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 21 67 0.000252 \n", + " 28 67 0.000674 \n", + " 37 67 0.001383 \n", + " 44 67 0.003104 \n", + " 51 67 0.005861 \n", + "... ... \n", + "2 1 11 21 0.890250 \n", + " 13 21 0.042400 \n", + " 22 0.848000 \n", + " 14 23 1.346000 \n", + " 15 24 1.308750 \n", + "\n", + " nu \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 21 67 1.827471e+14 \n", + " 28 67 1.086521e+14 \n", + " 37 67 6.840844e+13 \n", + " 44 67 4.414594e+13 \n", + " 51 67 2.840084e+13 \n", + "... ... \n", + "2 1 11 21 2.960539e+14 \n", + " 13 21 2.960473e+14 \n", + " 22 2.960492e+14 \n", + " 14 23 2.960492e+14 \n", + " 15 24 2.960464e+14 \n", + "\n", + " B_lu \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 21 67 6.933393e+07 \n", + " 28 67 3.124340e+08 \n", + " 37 67 1.017857e+09 \n", + " 44 67 3.539203e+09 \n", + " 51 67 1.038640e+10 \n", + "... ... \n", + "2 1 11 21 1.513552e+11 \n", + " 13 21 7.208767e+09 \n", + " 22 1.441744e+11 \n", + " 14 23 2.288429e+11 \n", + " 15 24 2.225119e+11 \n", + "\n", + " B_ul \\\n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 21 67 1.386679e+08 \n", + " 28 67 6.248679e+08 \n", + " 37 67 2.035713e+09 \n", + " 44 67 7.078406e+09 \n", + " 51 67 2.077280e+10 \n", + "... ... \n", + "2 1 11 21 1.009035e+11 \n", + " 13 21 7.208767e+09 \n", + " 22 1.081308e+11 \n", + " 14 23 1.716322e+11 \n", + " 15 24 1.780095e+11 \n", + "\n", + " A_ul \n", + "atomic_number ion_number level_number_lower level_number_upper \n", + "3 0 21 67 1.247877e+04 \n", + " 28 67 1.181808e+04 \n", + " 37 67 9.609265e+03 \n", + " 44 67 8.979504e+03 \n", + " 51 67 7.016705e+03 \n", + "... ... \n", + "2 1 11 21 3.860674e+07 \n", + " 13 21 2.757966e+06 \n", + " 22 4.137002e+07 \n", + " 14 23 6.566515e+07 \n", + " 15 24 6.810312e+07 \n", + "\n", + "[271741 rows x 8 columns]" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "atc.lines2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "```\n", - "num_xxx_y (int) : number of levels/lines.\n", - "diff_xxx (int) : difference in number of levels/lines.\n", - "val_xxx (bool) : `True` if levels/lines have the same value.\n", - "```" + "Finally, open HDF files can be closed." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": { - "scrolled": false + "ExecuteTime": { + "end_time": "2022-10-19T08:23:33.716686Z", + "start_time": "2022-10-19T08:23:33.708798Z" + } }, "outputs": [], "source": [ - "tt.style.applymap(highlight_values, subset=['val_lvl', 'val_lns']).applymap(\n", - " highlight_diff, subset=['diff_lvl', 'diff_lns'])" + "atc.teardown()" ] } ], @@ -298,7 +14775,41 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.13" + "version": "3.7.12" + }, + "varInspector": { + "cols": { + "lenName": 16, + "lenType": 16, + "lenVar": 40 + }, + "kernels_config": { + "python": { + "delete_cmd_postfix": "", + "delete_cmd_prefix": "del ", + "library": "var_list.py", + "varRefreshCmd": "print(var_dic_list())" + }, + "r": { + "delete_cmd_postfix": ") ", + "delete_cmd_prefix": "rm(", + "library": "var_list.r", + "varRefreshCmd": "cat(var_dic_list()) " + } + }, + "types_to_exclude": [ + "module", + "function", + "builtin_function_or_method", + "instance", + "_Feature" + ], + "window_display": false + }, + "vscode": { + "interpreter": { + "hash": "1594b6449aff2491ee84a7254c10f95be8345f93ea2e356d3f1569225a7f1028" + } }, "widgets": { "application/vnd.jupyter.widget-state+json": { diff --git a/docs/development/testing.rst b/docs/development/testing.rst index 0e2614b82..0c7617f22 100644 --- a/docs/development/testing.rst +++ b/docs/development/testing.rst @@ -34,6 +34,13 @@ A set of flags can be appended to the above command to run different kinds of te - `--cov=carsus --cov-report=xml --cov-report=html` Get code coverage results using the `pytest-cov `_ plugin. +- `--arraydiff-generate-path=carsus-refdata/arraydiff` + Generate reference files for tests marked with ``@pytest.mark.array_compare`` decorator and save them in the + refdata folder. + +- `--arraydiff --arraydiff-reference-path=carsus-refdata/arraydiff` + Run tests marked with ``@pytest.mark.array_compare`` decorator. + The tests would look for reference files in the refdata folder which can be generated using the above option. ============== Notebook Tests diff --git a/docs/index.rst b/docs/index.rst index 3a2ba0410..7ece083e3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,6 +10,7 @@ Carsus is a package to manage atomic datasets. It can read data from a variety o installation.rst quickstart + development/compare_atomic_files .. toctree:: :maxdepth: 2 diff --git a/docs/installation.rst b/docs/installation.rst index 832688929..543ca38bd 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -7,7 +7,7 @@ Prerequisites ============= #. Requires a valid Anaconda `or Miniconda `_ installation. -#. Download and extract the `Chianti Atomic Database `_ **v9.0.1** and set the following environment variable in your shell configuration file: +#. *(optional)*. Download and extract the `Chianti Atomic Database `_ **v9.0.1** and set the following environment variable in your shell configuration file: .. code :: diff --git a/docs/io/cmfgen.ipynb b/docs/io/cmfgen.ipynb index a35252e9c..0a37a6847 100644 --- a/docs/io/cmfgen.ipynb +++ b/docs/io/cmfgen.ipynb @@ -277,7 +277,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The values in the collisions dataframe are thermally-averaged effective collision strengths divided by the statistical weights of the lower levels. Please see Eq. A1 and A2 of [Przybilla & Butler, 2004](https://ui.adsabs.harvard.edu/abs/2004ApJ...609.1181P/abstract) for definitions. More information about the `collisions` table is stored inside the `collisional_metadata` attribute. " + "The values in the collisions dataframe are thermally-averaged effective collision strengths divided by the statistical weights of the lower levels. Please see Eq. A1 and A2 of Przybilla & Butler, 2004 for definitions. More information about the `collisions` table is stored inside the `collisional_metadata` attribute. " ] }, { diff --git a/docs/quickstart.ipynb b/docs/quickstart.ipynb index c5860cef1..00f92b95a 100644 --- a/docs/quickstart.ipynb +++ b/docs/quickstart.ipynb @@ -10,9 +10,9 @@ "\n", "
\n", "\n", - "**Read first:**\n", + "**Note:**\n", "\n", - "Get familiar with [Notation in Carsus](development/notation.rst) and learn how to select different sets of ions.\n", + "Get familiar with the [Notation in Carsus](development/notation.rst) and learn how to correctly select ions.\n", " \n", "
" ] @@ -21,7 +21,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Atomic Weights and Ionization Energies\n", + "## Atomic Weights and Ionization Energies (NIST)\n", "\n", "Download atomic weights and ionization energies from the National Institute of Standards and Technology (NIST)." ] @@ -49,9 +49,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Levels, Lines, Collisions and Cross-sections\n", + "## Levels, Lines, Collisions & Cross-sections\n", "\n", - "Carsus supports three sources of energy levels and spectral lines: GFALL, CHIANTI and CMFGEN.\n", + "Carsus supports three sources of energy levels and spectral lines: **GFALL**, **CHIANTI** and **CMFGEN**.\n", "\n", "### GFALL\n", "\n", @@ -61,7 +61,7 @@ "\n", "**Warning:**\n", " \n", - "Creating a `GFALLReader` instance is **required**. Other sources of levels and lines are **optional**.\n", + "Creating a `GFALLReader` instance is **required**.\n", "\n", "" ] @@ -83,7 +83,8 @@ "source": [ "from carsus.io.kurucz import GFALLReader\n", "\n", - "gfall_reader = GFALLReader('H-Zn', '/tmp/gfall.dat')" + "gfall_reader = GFALLReader('H-Zn',\n", + " '/tmp/gfall.dat')" ] }, { @@ -92,7 +93,15 @@ "source": [ "### CHIANTI\n", "\n", - "The Chianti Atomic Database reader provides levels and lines but also **collision strengths**." + "The Chianti Atomic Database reader provides levels and lines but also **collision strengths**.\n", + "\n", + "
\n", + "\n", + "**Note:**\n", + "\n", + "Creating a `ChiantiReader` instance is **optional**. \n", + "\n", + "
" ] }, { @@ -103,7 +112,9 @@ "source": [ "from carsus.io.chianti_ import ChiantiReader\n", "\n", - "chianti_reader = ChiantiReader('H-He', collisions=True, priority=20)" + "chianti_reader = ChiantiReader('H-He', \n", + " collisions=True, \n", + " priority=20)" ] }, { @@ -119,24 +130,15 @@ "source": [ "### CMFGEN\n", "\n", - "The atomic database of [CMFGEN](http://kookaburra.phyast.pitt.edu/hillier/web/CMFGEN.htm) is a source of levels, lines and (optionally) **ionization energies**, **photoionization cross-sections** and **collisions** ." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from carsus.io.cmfgen import CMFGENReader\n", + "The atomic database of [CMFGEN](http://kookaburra.phyast.pitt.edu/hillier/web/CMFGEN.htm) is a source of levels, lines and (optionally) **ionization energies**, **photoionization cross-sections** and **collisions**.\n", "\n", - "cmfgen_reader = CMFGENReader.from_config('Si 0-1', '/tmp/atomic', \n", - " priority=30,\n", - " ionization_energies=True,\n", - " cross_sections=True,\n", - " collisions=False,\n", - " temperature_grid=None,\n", - " drop_mismatched_labels=True)" + "
\n", + " \n", + "**Note:**\n", + "\n", + "Creating a `CMFGENReader` instance is **optional**. \n", + "\n", + "
" ] }, { @@ -147,11 +149,9 @@ "\n", "**Warning:**\n", " \n", - "Remember that cross-sections requires data from `H 0` so give this the reader enough `priority`. \n", + "Cross-sections require data from `H 0`, use this the reader with enough `priority` to select levels from this ion.\n", "\n", - "\n", - "\n", - "If you want to use the **ionization energies** from CMFGEN, you will need to apply this dirty hack to merge both sources:" + "" ] }, { @@ -160,11 +160,16 @@ "metadata": {}, "outputs": [], "source": [ - "import copy\n", - "import pandas as pd\n", + "from carsus.io.cmfgen import CMFGENReader\n", "\n", - "combined_ionization_energies = copy.deepcopy(ionization_energies)\n", - "combined_ionization_energies.base = cmfgen_reader.ionization_energies.combine_first(ionization_energies.base)" + "cmfgen_reader = CMFGENReader.from_config('Si 0-1', \n", + " '/tmp/atomic', \n", + " priority=30,\n", + " ionization_energies=True,\n", + " cross_sections=True,\n", + " collisions=False,\n", + " temperature_grid=None,\n", + " drop_mismatched_labels=True)" ] }, { @@ -173,7 +178,7 @@ "source": [ "## Zeta Data\n", "\n", - "Knox S. Long's ground state recombinations fractions ($\\zeta$)." + "Long & Knigge's ground state recombinations fractions ($\\zeta$)." ] }, { @@ -191,7 +196,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Dump to HDF5\n", + "## Create an Atomic Data File\n", "\n", "Finally, create a `TARDISAtomData` object and dump the data with the `to_hdf` method." ] @@ -207,7 +212,7 @@ "from carsus.io.output import TARDISAtomData\n", "\n", "atom_data = TARDISAtomData(atomic_weights,\n", - " combined_ionization_energies,\n", + " ionization_energies,\n", " gfall_reader,\n", " zeta_data,\n", " chianti_reader,\n", @@ -234,9 +239,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Metadata\n", + "### Metadata\n", "\n", - "Carsus stores metadata inside the HDF5 files to ensure reproducibility. This metadata includes a checksum per `DataFrame`, the current version of every dataset and relevant software versions. " + "Carsus stores metadata inside the HDF5 files to ensure reproducibility. This metadata includes a checksum for each stored table, version number or checksum of selected datasets, and versions of relevant packages. " ] }, { @@ -254,13 +259,31 @@ "metadata": {}, "outputs": [], "source": [ - "pd.read_hdf('kurucz_cd23_chianti_He_cmfgen_H_Si_I-II.h5', key='metadata')" + "store = pd.HDFStore('kurucz_cd23_chianti_He_cmfgen_H_Si_I-II.h5', key='metadata')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "store[\"metadata\"]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "store.root._v_attrs" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -274,7 +297,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.6.15" }, "widgets": { "application/vnd.jupyter.widget-state+json": { diff --git a/docs/references.bib b/docs/references.bib index f482626c2..6f60dd210 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -2,7 +2,7 @@ @ARTICLE{2002ApJ...579..725L, author = {{Long}, Knox S. and {Knigge}, Christian}, title = "{Modeling the Spectral Signatures of Accretion Disk Winds: A New Monte Carlo Approach}", - journal = {\apj}, + journal = {Astrophysical Journal}, keywords = {Accretion, Accretion Disks, Stars: Binaries: Close, Stars: Novae, Cataclysmic Variables, Stars: Individual: Constellation Name: Z Camelopardalis, Stars: Mass Loss, Astrophysics}, year = 2002, month = nov, @@ -20,7 +20,7 @@ @ARTICLE{2002ApJ...579..725L @ARTICLE{1997A&AS..125..149D, author = {{Dere}, K.~P. and {Landi}, E. and {Mason}, H.~E. and {Monsignori Fossi}, B.~C. and {Young}, P.~R.}, title = "{CHIANTI - an atomic database for emission lines}", - journal = {\aaps}, + journal = {Astronomy & Astrophysics, Supplement}, keywords = {ATOMIC DATA, ASTRONOMICAL DATA BASES: MISCELLANEOUS, ULTRAVIOLET: GENERAL, SUN: ATMOSPHERE, STARS: ATMOSPHERE}, year = 1997, month = oct, @@ -34,7 +34,7 @@ @ARTICLE{1997A&AS..125..149D @ARTICLE{2019ApJS..241...22D, author = {{Dere}, K.~P. and {Del Zanna}, G. and {Young}, P.~R. and {Landi}, E. and {Sutherland}, R.~S.}, title = "{CHIANTI{\textemdash}An Atomic Database for Emission Lines. XV. Version 9, Improvements for the X-Ray Satellite Lines}", - journal = {\apjs}, + journal = {Astrophysical Journal, Supplement}, keywords = {atomic data, atomic processes, ultraviolet: general, X-rays: general, Astrophysics - Solar and Stellar Astrophysics, Astrophysics - High Energy Astrophysical Phenomena, Physics - Atomic Physics}, year = 2019, month = apr, @@ -49,3 +49,21 @@ @ARTICLE{2019ApJS..241...22D adsurl = {https://ui.adsabs.harvard.edu/abs/2019ApJS..241...22D}, adsnote = {Provided by the SAO/NASA Astrophysics Data System} } + +@ARTICLE{2004ApJ...609.1181P, + author = {{Przybilla}, Norbert and {Butler}, Keith}, + title = "{Non-LTE Line Formation for Hydrogen Revisited}", + journal = {Astrophysical Journal}, + keywords = {Atomic Data, Line: Formation, Stars: Early-Type, Stars: Fundamental Parameters, Astrophysics}, + year = 2004, + month = jul, + volume = {609}, + number = {2}, + pages = {1181-1191}, + doi = {10.1086/421316}, +archivePrefix = {arXiv}, + eprint = {astro-ph/0406458}, + primaryClass = {astro-ph}, + adsurl = {https://ui.adsabs.harvard.edu/abs/2004ApJ...609.1181P}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +}