<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Load the SN from an SNANA simulation
This should work with all the supernovae in the simulation, but to make this example quick, let us just load the first one and represent the collection of SN.
Step1:  Pick out the very first SN and reformat it to look the way sncosmo  expects SN to look
Step2:  Make sure SNCosmo can understand band names
Step3:  We can look at the information in the light curve, or at the metadata
Step4:  Fitting SN to models
Instantiate a model and fit Supernovae to it. Since this is a very short demonstration for how to use the SNANA simulations
rather than how to use SNCosmo correctly, we will stick to basics. A few points to note that are being ignored, even though I remember them (there are probably others that I cannot remember right away 
<ASSISTANT_TASK:>
Python Code:
# location is relative or absolute path to the file
sne = ans.snanaSims.SnanaSims.fromSNANAfileroot('snana_fits', location=ans.example_data, n=1)
Explanation: Load the SN from an SNANA simulation
This should work with all the supernovae in the simulation, but to make this example quick, let us just load the first one and represent the collection of SN.
End of explanation
sn = ans.snanaSims.SnanaSims.reformat_SNANASN(sne.snList[0])
Explanation: Pick out the very first SN and reformat it to look the way sncosmo  expects SN to look
End of explanation
ans.snanaSims.SnanaSims.matchSNANAbandnamesinregistry()
Explanation: Make sure SNCosmo can understand band names
End of explanation
sn[:5]
sn.meta
Explanation: We can look at the information in the light curve, or at the metadata
End of explanation
model  = sncosmo.Model(source='salt2-extended')
model.set(z=sn.meta['REDSHIFT_FINAL'])
fit_results, fit_model = sncosmo.fit_lc(sn, model, vparam_names=['t0', 'x0', 'x1', 'c'])
print fit_model
fig = sncosmo.plot_lc(sn, model=fit_model, band=['u', 'g', 'r', 'i', 'z', 'Y'], zp=25., zpsys='ab')
sncosmo.chisq(sn, fit_model)/ fit_results.ndof
Explanation: Fitting SN to models
Instantiate a model and fit Supernovae to it. Since this is a very short demonstration for how to use the SNANA simulations
rather than how to use SNCosmo correctly, we will stick to basics. A few points to note that are being ignored, even though I remember them (there are probably others that I cannot remember right away :) :
Photometric redshifts are hard even when we have the model
'salt2' can have problems with high redshift supernovae, so using salt2-extended 
MW extinction MUST be added to the model, but I am ignoring for now
Model covariance should also be added for accurate results
End of explanation
<END_TASK>