<jupyter_start><jupyter_text>Store photo-nuclear interaction tables<jupyter_code>talys = ppn.CrossSectionsFromAscii('CRP2_TALYS')
fluka = ppn.CrossSectionsFromAscii('PEANUT_IAS')
psb   = ppn.CrossSectionsFromAscii('PSB')
for modname, pnmod in [('CRP2_TALYS', talys), ('PEANUT_IAS', fluka), ('PSB', psb)]:
    hdf_group = prince_db["photo_nuclear"].create_group(modname)
    hdf_group.create_dataset('energy_grid', data=pnmod.energy_grid,
        chunks=True, compression="lzf", shuffle=True)
    hdf_group.create_dataset('inel_mothers', data=pnmod.inel_mothers,
        chunks=True, compression="lzf", shuffle=True)
    hdf_group.create_dataset('mothers_daughters', data=pnmod.mothers_daughters,
        chunks=True, compression="lzf", shuffle=True)
    hdf_group.create_dataset('inelastic_cross_sctions', data=pnmod.inelastic_cross_sctions,
        chunks=True, compression="lzf", shuffle=True)
    hdf_group.create_dataset('fragment_yields', data=pnmod.fragment_yields,
        chunks=True, compression="lzf", shuffle=True)
print(prince_db.keys())
print(prince_db['photo_nuclear'].keys())
print(prince_db['photo_nuclear']['CRP2_TALYS'].keys())
sophia = ppn.PhotoMesonCSFromPickle('sophia_')
hdf_group = prince_db["photo_nuclear"].create_group('SOPHIA')
hdf_group.create_dataset('energy_grid', data=sophia.energy_grid,
    chunks=True, compression="lzf", shuffle=True)
hdf_group.create_dataset('xbins', data=sophia.xbins,
    chunks=True, compression="lzf", shuffle=True)
hdf_group.create_dataset('inel_mothers', data=sophia.inel_mothers,
    chunks=True, compression="lzf", shuffle=True)
hdf_group.create_dataset('mothers_daughters', data=sophia.mothers_daughters,
    chunks=True, compression="lzf", shuffle=True)
hdf_group.create_dataset('inelastic_cross_sctions', data=sophia.inelastic_cross_sctions,
    chunks=True, compression="lzf", shuffle=True)
hdf_group.create_dataset('fragment_yields', data=sophia.fragment_yields,
    chunks=True, compression="lzf", shuffle=True)
print(prince_db.keys())
print(prince_db['photo_nuclear'].keys())
print(prince_db['photo_nuclear']['SOPHIA'].keys())<jupyter_output><KeysViewHDF5 ['EBL_models', 'photo_meson', 'photo_nuclear']>
<KeysViewHDF5 ['CRP2_TALYS', 'PEANUT_IAS', 'PSB', 'SOPHIA']>
<KeysViewHDF5 ['energy_grid', 'fragment_yields', 'inel_mothers', 'inelastic_cross_sctions', 'mothers_daughters', 'xbins']><jupyter_text>Store EBL photon field arrays (for spline construction)<jupyter_code>for ebl_obj in [ppf.Francescini2008(), ppf.Inoue2013(),
                ppf.Gilmore2011(), ppf.Dominguez2010()]:
    ebl_gr = prince_db['EBL_models'].create_group(ebl_obj.__class__.__name__)
    xyz_d = ebl_obj.get_xyz()
    for subset in xyz_d:
        sub_gr = ebl_gr.create_group(subset)
        sub_gr.create_dataset("x", data=xyz_d[subset][0],
        chunks=True, compression="lzf", shuffle=True)
        sub_gr.create_dataset("y", data=xyz_d[subset][1],
        chunks=True, compression="lzf", shuffle=True)
        sub_gr.create_dataset("z", data=xyz_d[subset][2],
        chunks=True, compression="lzf", shuffle=True)
        
print(prince_db['EBL_models'].keys())
print(prince_db['EBL_models']['Dominguez2010'].keys())
print(prince_db['EBL_models']['Dominguez2010']['base'].keys())
prince_db.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1513579493439121, 'fraction_numerical': 0.010375343301800427, 'mean_word_length': 7.492227979274611, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '129524', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1209, 'n_words': 143, 'path': 'construct_prince_database.ipynb', 'repo_name': 'joheinze/PriNCe-data-utils', 'size': '3277'}