<jupyter_start><jupyter_text>Cube spectral fitting Start the CubeViz application.<jupyter_code># Suppress warnings
import warnings

with warnings.catch_warnings():
    warnings.simplefilter("ignore")
from jdaviz import CubeViz

cubeviz = CubeViz()
cubeviz.app<jupyter_output><empty_output><jupyter_text>Load cube data.<jupyter_code>from astropy.utils.data import download_file

# This file is originally from https://data.sdss.org/sas/dr14/manga/spectro/redux/v2_1_2/7495/stack/manga-7495-12704-LOGCUBE.fits.gz
# but has been modified to correct some inconsistencies in the way units are parsed
fn = download_file('https://stsci.box.com/shared/static/28a88k1qfipo4yxc4p4d40v4axtlal8y.fits', cache=True)
cubeviz.app.load_data(fn)<jupyter_output><empty_output><jupyter_text>Now, go back to the cell where the CubeViz window is. - click on the plugins tray open button at the top right corner. - open the Model Fitting plugin. - build the intial model using the resources in the plugin.  - click on Apply to Cube and wait until it finishes. Once the fit is done, this attribute in the CubeViz object contains the fitted model parameters in the form of a python dictionary.Each entry in the dictionary corresponds to one parameter in the CompoundModel instance that was generated by the fitter from the arithmetic model expression. The key for each entry is the parameter name as defined by the CompoundModel instance.Each entry's value is a 2D numpy array with Quantity values representing the corresponding fitted parameter value over all spaxels.<jupyter_code>cubeviz.fitted3d<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06355140186915888, 'fraction_numerical': 0.019937694704049845, 'mean_word_length': 5.636363636363637, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '247588', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 509, 'n_tokens_neox': 483, 'n_words': 177, 'path': 'notebooks/concepts/Cube_fit.ipynb', 'repo_name': 'javerbukh/jdaviz', 'size': '1605'}