<jupyter_start><jupyter_text>First possible usage : A trivial conversion from gaussian mixmod to same voigt bases (so gamma set to 0)<jupyter_code># Convert to a gaussian mixture using 301 sample points and ncomps components
ncomps = 3
xvals = np.linspace(0, 3.0, 301)
ens_m = qp.convert(ens_red, 'mixmod', xvals=xvals, ncomps=ncomps)
ens_voigt = qp.convert(ens_m, 'voigt')
key = 1
axes_m = ens_red.plot(key, xlim=(0, 0.3), label="original", marker='.')
_ = ens_m.plot(key, axes=axes_m, label="gaus")
_ = ens_voigt.plot(key, axes=axes_m, label="voigt")
leg_m = axes_m.figure.legend()<jupyter_output><empty_output><jupyter_text>2 remarks :- the mixmod fit seems a bit unstable : https://github.com/LSSTDESC/qp/issues/28- the truncation at z=0 is quite interesting; this could be typical of a faint star, for which the star/galaxy separation fails but the colours still allow for a non zero redshift solution to the photoz estimation. The fact that the representaiton has a second mode distinctly distinct from 0 compared to the original pdf is a potentially serious concern The next stage would be to convert the original xy representation into a sparse one, based on the orthogonal matching pursuit scheme and the Voigt basis implemented in sparse_rep<jupyter_code>ens_sparse = qp.convert(ens_red, class_name='sparse')
ens_sparse[9]
x = np.linspace(0.005,0.3,300)
y = ens_sparse.pdf(x)[9]
axes_m = ens_red.plot(9, xlim=(0, 0.3), label="original", color='r')
axes_m.plot(x,y)
ens_sparse.plot_native(ens_sparse[key],axes=axes_m, label="sparse",marker='.',color='b',linewidth=0)
key = 9
axes_m = ens_red.plot(key, xlim=(0, 0.5), label="original", color='r')
_ = ens_sparse.plot(key,axes=axes_m, label="sparse",marker='.',color='b',linewidth=0)
leg_m = axes_m.figure.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1243753470294281, 'fraction_numerical': 0.022765130483064965, 'mean_word_length': 6.32520325203252, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, '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': '627649', 'license': 'MIT', 'n_tokens_mistral': 669, 'n_tokens_neox': 623, 'n_words': 185, 'path': 'docs/notebooks/Sparse qp interface.ipynb', 'repo_name': 'joezuntz/qp', 'size': '1801'}