<jupyter_start><jupyter_text>Old code<jupyter_code>import numpy as np
import pylab as plt
%matplotlib inline
import json
from frbpa.utils import get_phase
with open('121102_data.json', 'r') as f:
    r1_data = json.load(f)
burst_dict = r1_data['bursts']

all_bursts = []
for k in burst_dict.keys():
    all_bursts += burst_dict[k]
period = 157
l = []
for k in burst_dict:
    l.append(get_phase(np.array(burst_dict[k]), period, ref_mjd=58200))
refphases = np.linspace(0,1,1000)
_, bin_edges = np.histogram(refphases, bins=40)
names = burst_dict.keys()
NUM_COLORS = len(names)
plt.figure(figsize=(10,8))
cm = plt.get_cmap('jet')
colors = [cm(1.*i/NUM_COLORS) for i in range(NUM_COLORS)]
_ = plt.hist(l, bins=bin_edges, stacked=True, density=False, label=names, edgecolor='black', 
             linewidth=0.5, color=colors)
plt.xlabel('Phase')
plt.ylabel('No. of Bursts')
plt.title(f'121102 bursts phases at a period of {period}')
plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14830072090628219, 'fraction_numerical': 0.037075180226570546, 'mean_word_length': 5.657534246575342, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '664519', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 413, 'n_tokens_neox': 384, 'n_words': 82, 'path': 'examples/r1/phase_plot.ipynb', 'repo_name': 'KshitijAggarwal/frbpa', 'size': '971'}