<jupyter_start><jupyter_text>Compute Ion Populations with Non-equilibrium Ionization<jupyter_code>import os
import toolz
import traceback
import time

import h5py
import numpy as np
import astropy.units as u
import matplotlib.pyplot as plt
import dask
import distributed

import synthesizAR
from synthesizAR.atomic import EmissionModel,Element
from synthesizAR.interfaces import EbtelInterface

%matplotlib inline
client = distributed.Client()
field = synthesizAR.Field.restore('/storage-home/w/wtb2/data/timelag_synthesis_v2/low_frequency/field_checkpoint/')
em_model = EmissionModel.restore('/storage-home/w/wtb2/data/timelag_synthesis_v2/base_emission_model.json')
future = em_model.calculate_ionization_fraction(field,
                                               '/storage-home/w/wtb2/data/timelag_synthesis_v2/low_frequency/nei/ionization_fractions.h5',
                                               interface=EbtelInterface,
                                                client=client)
future
future.release()
future = None
for ion in Element('iron',[1e6]*u.K):
    y_nei = em_model.get_ionization_fraction(field.loops[50], ion)
    plt.plot(field.loops[50].time,y_nei[:,0])
plt.yscale('log')
plt.ylim(1e-6,1)
plt.xlim(3500,5000)
em_model.save('/storage-home/w/wtb2/data/timelag_synthesis_v2/low_frequency/nei/emission_model.json')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09832483612527312, 'fraction_numerical': 0.02039329934450109, 'mean_word_length': 3.7708333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '431070', 'license': 'MIT', 'n_tokens_mistral': 472, 'n_tokens_neox': 446, 'n_words': 70, 'path': 'notebooks/low_frequency/nei_populations.ipynb', 'repo_name': 'rice-solar-physics/synthetic-observables-paper-models', 'size': '1373'}