flavor=nu_type,sample=sample_name)
            plot_bin_slices(true_val, cnn_val, energy_truth=cnn_Z,
                        weights=true_weights,
                        old_reco = retro_val,old_reco_truth=retro_true_val,
                        reco_energy_truth=retro_Z,
                        old_reco_weights=retro_weights,use_fraction = True,
                        bins=syst_bin, min_val=-550, max_val=-150,\
                        save=save, savefolder=save_folder_name,\
                        variable=plot_name, units="(m)",
                        reco_name=reco_name, xvariable="Reconstructed Z",
                        flavor=nu_type,sample=sample_name)

        if variable == "energy":
            if plot_others:
                plot_2D_prediction_fraction(true_val, cnn_val,weights=true_weights,\
                                save=save, savefolder=save_folder_name,bins=bins,\
                                xminval=minval, xmaxval=maxval, yminval=-2,ymaxval=2.,\
                                variable=plot_name, units=plot_units, reco_name="CNN")
                plot_2D_prediction_fraction(retro_true_val, retro_val, weights=retro_weights,
                                save=save, savefolder=save_folder_name,bins=bins,\
                                xminval=minval, xmaxval=maxval, yminval=-2,ymaxval=2.,\
                                variable=plot_name, units=plot_units, reco_name=reco_name)
                plot_2D_prediction_fraction(true_val, cnn_val,weights=true_weights,\
                                save=save, savefolder=save_folder_name,bins=bins,\
                                variable=plot_name, units=plot_units, reco_name="CNN")
                plot_2D_prediction_fraction(retro_true_val, retro_val, weights=retro_weights,
                                save=save, savefolder=save_folder_name,bins=bins,\
                                variable=plot_name, units=plot_units, reco_name=reco_name)

            if plot_main:
                if nu_type == "NuMu" or nu_type == "numu":
                    dist_title = r'$\nu_\mu$ '
     plot_single_resolution(Y_test_use[:,true_index]*maxabs_factor,\
                Y_test_predicted[:,NN_index]*maxabs_factor,\
                use_old_reco = True, old_reco = reco_test_use[:,true_index],\
                use_fraction=True,bins=bins,maxaxis=2.,minaxis=-2.,\
                save=save,savefolder=save_folder_name,\
                variable=plot_name,units=plot_units)
     plot_bin_slices(Y_test_use[:,true_index]*maxabs_factor, Y_test_predicted[:,NN_index]*maxabs_factor,\
                 old_reco = reco_test_use[:,true_index],\
                 use_fraction = use_frac,\
                 bins=10,min_val=minval,max_val=maxval,\
                 save=True,savefolder=save_folder_name,\
                 variable=plot_name,units=plot_units, epochs = epoch,reco_name=reco_name)
 if first_var == "energy" and num == 0:
     plot_2D_prediction_fraction(Y_test_use[:,true_index]*maxabs_factor,\
                     Y_test_predicted[:,NN_index]*maxabs_factor,\
                     save,save_folder_name,bins=bins,axis_square=True,\
                     minval=-2.,maxval=2,\
                     variable=plot_name,units=plot_units)
     plot_bin_slices(Y_test_use[:,true_index]*maxabs_factor, Y_test_predicted[:,NN_index]*maxabs_factor,\
                 use_fraction = use_frac,\
                 bins=10,min_val=minval,max_val=maxval,\
                 save=True,savefolder=save_folder_name,\
                 variable=plot_name,units=plot_units)
     #plot_length_energy(Y_test_use, Y_test_predicted[:,NN_index]*maxabs_factor,\
     #                    use_fraction=True,ebins=20,tbins=20,\
     #                    emin=minvals[first_var_index], emax=maxvals[first_var_index],\
     #                    tmin=0.,tmax=450.,tfactor=maxabs_factors[2],\
     #                    savefolder=save_folder_name)
 if num > 0 or first_var == "zenith":
     plot_bin_slices(Y_test_use[:,true_index], Y_test_predicted[:,NN_index], \
                    energy_truth=Y_test_use[:,0]*max_energy, \
                      variable=plot_name,units=plot_units,  reco_name=reco_name)
  plot_single_resolution(Y_test_use[:,true_index]*maxabs_factor,\
                  reco_test_use[:,NN_index],\
                 minaxis=-maxval,maxaxis=maxval,bins=bins,
                 save=save,savefolder=save_folder_name,\
                 variable=plot_name,units=plot_units)
  plot_bin_slices(Y_test_use[:,true_index]*maxabs_factor, reco_test_use[:,NN_index],\
                  use_fraction = False,\
                  bins=10,min_val=minval,max_val=maxval,\
                  save=True,savefolder=save_folder_name,\
                  variable=plot_name,units=plot_units)
 
  if num ==0:
      plot_2D_prediction_fraction(Y_test_use[:,true_index]*maxabs_factor,\
                      reco_test_use[:,NN_index],\
                      save,save_folder_name,bins=bins,\
                      minval=0,maxval=2,\
                      variable=plot_name,units=plot_units)
      plot_single_resolution(Y_test_use[:,true_index]*maxabs_factor,\
                 reco_test_use[:,NN_index]*maxabs_factor,\
                 use_fraction=True,\
                 minaxis=-2.,maxaxis=2.,
                 save=save,savefolder=save_folder_name,\
                 variable=plot_name,units=plot_units)
      plot_bin_slices(Y_test_use[:,true_index]*maxabs_factor, reco_test_use[:,NN_index],\
                  use_fraction = use_frac,\
                  bins=10,min_val=minval,max_val=maxval,\
                  save=True,savefolder=save_folder_name,\
                  variable=plot_name,units=plot_units)
      #plot_length_energy(Y_test_use, reco_test_use[:,NN_index]*maxabs_factor,\
      #                    use_fraction=True,ebins=20,tbins=20,\