<jupyter_start><jupyter_text>Fit the Missed SNe PTF38093380 for CFro---<jupyter_code># %matplotlib inline
%matplotlib notebook

try:
    from importlib import reload
except:
    pass

import os
import sys
import numpy as np
from astropy.table import Table

import pycoco as pcc
data_path = "/Users/berto/data/cfro_SNe_orig.dat"
p = pcc.classes.PhotometryClass()
p.load(data_path)
p.plot()
sn = pcc.classes.SNClass("Cfro_SNe_orig")
sn.load_phot(path=data_path, verbose=True)
x = sn.phot.phot
x["ptfzp"] = 27.
x["m"] = -2.5*np.log10(x["flux"])+x["ptfzp"]
zp = pcc.kcorr.calc_AB_zp("PTF48_R")
x["PTFR_AB_zp"] = zp
scaling = np.nanmean(x["flux"]/np.power(10., -(x["m"]+x["PTFR_AB_zp"])/2.5))
print(scaling)
x["flux"] = x["flux"]/scaling
x["flux_err"] = x["flux_err"]/scaling
x.show_in_notebook()
y = x[["MJD", "flux", "flux_err", "filter"]]
y
p = pcc.classes.PhotometryClass()
p.load_table(y)
p.save("PTF38093380.dat", path = "/Users/berto/projects/")
p.plot()
pcc.coco.run_LCfit("PTF38093380")
pcc.coco.run_LCfit("/Users/berto/projects/PTF38093380.dat")
sn = pcc.classes.SNClass("PTF38093380")
sn.load_phot(path="/Users/berto/projects/PTF38093380.dat")
sn.get_lcfit(os.path.join(pcc.defaults._default_coco_dir_path, "recon/" + sn.name + ".dat"))
sn.get_lcfit(os.path.join(pcc.defaults._default_coco_dir_path, "recon/" + sn.name + ".dat"))
sn.plot_lc(multiplot=False, showsnname=True)
sn.plot_lc(multiplot=False, showsnname=True, savepdf=True, outpath="/Users/berto/projects/PTF38093380")<jupyter_output><empty_output><jupyter_text>Peak Absolute Magnitude and Distance--- Li et al. 2011 (https://ui.adsabs.harvard.edu/abs/2011MNRAS.412.1441L/abstract) typical Ibc peak abs mag ~-17, faintest~-14,  brightest are -18<jupyter_code>from astropy.cosmology import LambdaCDM
from astropy.coordinates import Distance
max_flux = pcc.utils.get_mjdmax_flux(sn, "PTF48_R")
print(max_flux)
m_app = -2.5*np.log10(max_flux)-zp
print(m_app)
M_typical = -17.0
M_bright = -18.0
M_faint = -14.0

mu_typical = m_app - M_typical
mu_bright = m_app - M_bright
mu_faint = m_app - M_faint

print(mu_bright, mu_typical, mu_faint)
d = Distance(distmod=[mu_bright, mu_typical, mu_faint])
d
[dist.z for dist in d]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1650836725463591, 'fraction_numerical': 0.04703753957485301, 'mean_word_length': 5.934169278996865, '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': '19501', 'license': 'MIT', 'n_tokens_mistral': 1049, 'n_tokens_neox': 957, 'n_words': 156, 'path': 'notebooks/applications/CFro_CoCo_SN_lcfit_PTF38093380.ipynb', 'repo_name': 'RobFirth/pycoco', 'size': '2211'}