files[0][0]))
ha_velocity = calc_velocity(ref_spec.wave, Ha).to(u.km/u.s)
ref_norm_indx = np.where(ha_velocity<(calc_velocity(6000, Ha).to(u.km/u.s)))[0]
#Consider making this all one color
colors = visualization.make_color_wheel(spectra_files+[1], cmap=cm_rainbow)

#Scale phase by this when offsetting
ha_scale = 0.1
hb_scale = 0.6
he_scale = 0.1

#Plot the dates for the HV features
HV_H_limits = np.array((-40,-80))
HV_He_limits = np.array((-20, -60))
ax1.axhspan(*(HV_H_limits*ha_scale), color='#777777', alpha=0.2)
ax2.axhspan(*(HV_H_limits*hb_scale), color='#777777', alpha=0.2)
ax3.axhspan(*(HV_He_limits*he_scale),color='#777777', alpha=0.2)

#Find the velocity range plotted in Ha for use in Hb and HeI
ha_vel_xmin = calc_velocity(6000, Ha)
hb_obs_wl_min = calc_obs_wave(ha_vel_xmin, Hb)

#Plot Ha and Hb
for indx, ifile in enumerate(spectra_files):
    filename, idir = ifile
    ispec = read_iraf_spectrum(os.path.join(idir, filename))
    ha_velocity = calc_velocity(ispec.wave, Ha).to(u.km/u.s)
    hb_velocity = calc_velocity(ispec.wave, Hb).to(u.km/u.s)    
    scale_ispec = spec.scale_spectra(ispec, ref_spec)
    scale_factor_ha = np.interp(6000, scale_ispec.wave, scale_ispec.flux)
    scale_factor_hb = np.interp(hb_obs_wl_min, scale_ispec.wave, scale_ispec.flux)
    date = Time(fits.getval(os.path.join(idir, filename), 'date-obs', 0), out_subfmt='date')
    phase = int((date-Time(sn15oz.jdexpl, format='jd')).value)
    
    if int(phase) == 8:
        ax1.text(-26, -ha_scale*phase*0.85, '{}d'.format(int(phase)), 
                  ha='right', va='bottom',  color='k')
        ax1.plot(ha_velocity/1000, scale_ispec.flux/scale_factor_ha-1.0-ha_scale*phase*0.8, color=colors[indx])
        ax2.plot(hb_velocity/1000, scale_ispec.flux/scale_factor_hb-1.0-hb_scale*phase*0.8, color=colors[indx])
    elif int(phase) == 9:
        ax1.text(-26, -ha_scale*phase*0.98, '{}d'.format(int(phase)), 
                  ha='right', va='bottom',  color='k')
        ax1.plot(ha_velocity/1000, scale_ispec.flux/scale_factor_ha-1.0-ha_scale*phase, color=colors[indx])
        ax2.plot(hb_velocity/1000, scale_ispec.flux/scale_factor_hb-1.0-hb_scale*phase, color=colors[indx])
    else:
        ax1.plot(ha_velocity/1000, scale_ispec.flux/scale_factor_ha-1.0-ha_scale*phase, color=colors[indx])
        ax1.text(-26, -ha_scale*phase, '{}d'.format(int(phase)), 
                  ha='right', va='bottom',  color='k')
        ax2.plot(hb_velocity/1000, scale_ispec.flux/scale_factor_hb-1.0-hb_scale*phase, color=colors[indx])

    
#Plot Cachito
dates_cachito = np.arange(4, 95)
model_cachito_vel = power_fit_cachito(dates_cachito)
ax1.plot(-model_cachito_vel/1000, -dates_cachito*ha_scale, c='#AE76A3', ls='--')
ax2.plot(-model_cachito_vel/1000, -dates_cachito*hb_scale, c='#AE76A3', ls='--')

model_ha_vel = power_fit_ha(dates_cachito)
ax1.plot(-model_ha_vel/1000, -dates_cachito*ha_scale, color='#A5170E', ls=':')

model_hb_vel = power_fit_hb(dates_cachito)
ax2.plot(-model_hb_vel/1000, -dates_cachito*hb_scale, color='#A5170E', ls=':')

#Plot the IR
heI_obs_wl_min = calc_obs_wave(ha_vel_xmin, HeI)
scale_sofi1 = spec.scale_spectra(spec_sofi1, spec_sofi2) #SOFI1
scale_irtf = spec.scale_spectra(spec_irtf, spec_sofi2) #IRTF
heI_velocity_sofi2 = calc_velocity(spec_sofi2.wave, HeI).to(u.km/u.s)
heI_velocity_sofi1 = calc_velocity(scale_sofi1.wave, HeI).to(u.km/u.s)
heI_velocity_irtf = calc_velocity(scale_irtf.wave, HeI).to(u.km/u.s)

scale_factor_HeI_sofi1 = np.interp(heI_obs_wl_min, scale_sofi1.wave, scale_sofi1.flux)
phase_sofi1 = (Time('2015-09-05')-Time(sn15oz.jdexpl, format='jd')).value
ax3.plot(heI_velocity_sofi1/1000, scale_sofi1.flux/scale_factor_HeI_sofi1-1.0-he_scale*phase_sofi1, color=colors[0])
ax3.text(3, -he_scale*phase_sofi1, '{}d'.format(int(phase_sofi1)), 
              ha='left', va='bottom',  color='k')

scale_factor_HeI_sofi2 = np.interp(heI_obs_wl_min, spec_sofi2.wave, spec_sofi2.flux)
phase_sofi2 = (Time('2015-10-05')-Time(sn15oz.jdexpl, format='jd')).value
scale_factor_HeI_sofi22 = np.interp(heI_obs_wl_min, spec_sofi2.wave, spec_sofi2.flux)
ax3.plot(heI_velocity_sofi2/1000, spec_sofi2.flux/scale_factor_HeI_sofi2-1.0-he_scale*phase_sofi2, color=colors[-6])
ax3.text(3, -he_scale*phase_sofi2, '{}d'.format(int(phase_sofi2)), 
              ha='left', va='bottom',  color='k')

scale_factor_HeI_irtf = np.interp(heI_obs_wl_min, scale_irtf.wave, scale_irtf.flux)
phase_irtf = (Time('2015-10-10')-Time(sn15oz.jdexpl, format='jd')).value
ax3.plot(heI_velocity_irtf/1000, scale_irtf.flux/scale_factor_HeI_irtf-1.0-he_scale*phase_irtf, color=colors[-5])
ax3.text(3, -he_scale*phase_irtf, '{}d'.format(int(phase_irtf)), 
              ha='left', va='bottom', color='k')

ylimits = np.array((-90, -4))
ax1.set_xticks([-20, 0])
ax1.