<jupyter_start><jupyter_text>Using the API of candels-blender<jupyter_code>import pathlib
import numpy as np

from blender import Blender
relative_datapath = '../data'

cwd = pathlib.Path.cwd()
datapath = cwd / relative_datapath

instamps = datapath / 'candels_img.npy'
insegmaps = datapath / 'candels_seg.npy'
incat = datapath / 'candels_cat.csv'<jupyter_output><empty_output><jupyter_text>1) Initialise the Blender with the input data<jupyter_code>blender = Blender(instamps, insegmaps, incat,
                  magdiff=2, raddiff=4, seed=42)<jupyter_output><empty_output><jupyter_text>2) Perform some cuts<jupyter_code>blender.make_cut(blender.cat.mag < 23)
blender.make_cut(blender.cat.galtype != 'irr')<jupyter_output><empty_output><jupyter_text>Print the number of individual galaxies left after the cuts<jupyter_code>print(blender.n_gal)<jupyter_output>1499<jupyter_text>3) Look at a few CANDELS stampsStart by looking at the galaxy catalog<jupyter_code>blender.cat.head(10)<jupyter_output><empty_output><jupyter_text>Select two galaxies<jupyter_code>gal1 = 348
gal2 = 703<jupyter_output><empty_output><jupyter_text>Display each galaxy and their segmentation map, as well as the segmentation after the neighbours have been masked out.<jupyter_code>blender.plot_galaxy(gal1)
blender.plot_galaxy(gal2)<jupyter_output><empty_output><jupyter_text>4) Create a blend with the two galaxies<jupyter_code>blender.plot_blend(gal1, gal2)<jupyter_output><empty_output><jupyter_text>First pic is the resulting blend image, then the segmap of the central galaxy, followed by the segmap of the shifted companion, and finally the segmap of the overlap.Note that every call to `blender.blend()` is currently not reproducible since it triggers a random shift. This is why each new call to `plot_blend()` with the same galaxies will show a slightly different result.If the neighbours had not been masked, one could have this:<jupyter_code>blender.plot_blend(gal1, gal2, masked=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08745627186406797, 'fraction_numerical': 0.014992503748125937, 'mean_word_length': 7.2727272727272725, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 36, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '641027', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 717, 'n_tokens_neox': 683, 'n_words': 175, 'path': 'notebooks/manual_blender.ipynb', 'repo_name': 'aboucaud/candels-blender', 'size': '2001'}