pgNum = 296
ccdNum = 28
im_filepath=(
    "/epyc/users/smotherh/"
    +"good_warps_good_seeing/{:03}/{:02}".format(
        pgNum,ccdNum))
res_filepath=(
    "/epyc/users/smotherh/DECAM_Data_Reduction/"
    +"kbmod_results/{:03}/{:02}".format(pgNum,ccdNum))
time_file=(
    "/epyc/users/smotherh/DECAM_Data_Reduction/"
    +"loriallen_times.dat")

results_suffix = "DEMO"
v_min = 270 # Pixels/day
v_max = 320.
#Offset by PI for prograde orbits in lori allen data
ang_below = -np.pi+np.pi/10. # Angle below ecliptic
ang_above = np.pi+np.pi/10. # Angle above ecliptic
v_steps = 64
ang_steps = 32

v_arr = [v_min, v_max, v_steps]
ang_arr = [ang_below, ang_above, ang_steps]

num_obs = 15

input_parameters = {
    # Required
    'im_filepath':im_filepath, 'res_filepath':res_filepath,
    'time_file':time_file, 'output_suffix':results_suffix, 'v_arr':v_arr,
    'ang_arr':ang_arr,
    
    # Important
    'num_obs':num_obs, 'do_mask':True, 'lh_level':10., 'gpu_filter':True,
    
    # Fine tuning
    'sigmaG_lims':[15,60], 'mom_lims':[37.5,37.5,1.5,1.0,1.0],
    'peak_offset':[3.0,3.0], 'chunk_size':1000000,
    'stamp_type':'cpp_median', 'eps':0.03, 'clip_negative':True,
    'mask_num_images':10, 'sigmaG_filter_type':'lh'
}

rs = run_search(input_parameters)
rs.run_search()


"""
Explanation: Setup file paths and run the KBMOD GPU Search
End of explanation
"""


vis_results = VisualizeResults('/epyc/users/smotherh/DECAM_Data_Reduction/kbmod_results/{0:03}/{1:02d}/',
    '/epyc/projects2/smotherh/DECAM_Data_Reduction/pointing_groups_hyak/Pointing_Group_{0:03}/warps/{1:02d}/')

"""
Explanation: Use the VisualizeResults class to see the results from the search
This class expects the CNN named resnet_2.h5 to be in the same directory, but can be remapped with cnn_path='path-to-cnn'
End of explanation
"""


_=vis_results.show_pg_results(296,28, cutoff = 0.75, lh_lim=15, suffix='DEMO', plot_stamps='coadd',use_widget=False)

"""
Explanation: Look at the coadded stamps for this ccd
End of explanation
"""


_=vis_results.show_pg_results(296,28, cutoff = 0.75, lh_lim=15, suffix='DEMO', plot_stamps='all',use_widget=True)

"""
Explanation: Look at all the stamps for this ccd
End of explanation
"""


