<jupyter_start><jupyter_text>Make your own `ModelGrid` objectHere you can turn a bunch of arbitrary numpy arrays into a `ModelGrid` object.First, create an empty instance with the desired parameters.<jupyter_code>mg = ModelGrid('Filippazzo+2016', ['spectral_type', 'teff'], wave_units=q.um, flux_units=q.erg/q.s/q.cm**2/q.AA)<jupyter_output><empty_output><jupyter_text>To save all this work we are doing, let's make a directory of XML files from our spectra that can be loaded in very fast later.<jupyter_code># Grab all SEDs
files = glob('/Users/jfilippazzo/Documents/CUNY/Dissertation/Sample/absolute SEDs/*.txt')
for fname in files:
    with open(fname) as f:
        
        # Read the header
        content = [l.split('=') for l in f.readlines() if l.startswith('#') and '=' in l]
        d = {k[0].split(' ')[1]:k[1].split(' ')[0].replace('\n','') for k in content}
        
    # Get the spectrum
    spec = np.genfromtxt(fname, unpack=True)
    
    # Add the object
    mg.add_model(spec, **d)
print(mg.index)
mg.save('/Users/jfilippazzo/Desktop/Filippazzo2016.p')<jupyter_output>ModelGrid 'Filippazzo+2016' saved to /Users/jfilippazzo/Desktop/Filippazzo2016.p
{'fraction_non_alphanumeric': 0.13834329632792486, 'fraction_numerical': 0.017933390264730998, 'mean_word_length': 4.185840707964601, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '278847', 'license': 'MIT', 'n_tokens_mistral': 424, 'n_tokens_neox': 404, 'n_words': 109, 'path': 'sedkit/notebooks/making_modelgrids.ipynb', 'repo_name': 'hover2pi/sedkit', 'size': '1171'}