Skip to content

Commit

Permalink
updated unit test and added test files
Browse files Browse the repository at this point in the history
  • Loading branch information
ckarwin committed Oct 31, 2024
1 parent e74d50e commit f280b1d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
Binary file not shown.
17 changes: 17 additions & 0 deletions cosipy/test_data/inputs_crab_continuum_bg_estimation_testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#----------#
# Data I/O:

# data files available on the COSI Sharepoint: https://drive.google.com/drive/folders/1UdLfuLp9Fyk4dNussn1wt7WEOsTWrlQ6
# The tra file is the first 10 seconds of the crab sim from mini-DC2,
# and the ori file is the corresponding ori from mini-DC2.
data_file: "GalacticScan.inc1.id1.crab2hr.extracted.testsample.tra.gz" # full path
ori_file: "/project/majello/astrohe/ckarwin/COSI/COSIpy_Development/Continuum_BG_Estimation/Run_1/Data_Files/20280301_3_month.ori" # full path
unbinned_output: 'fits' # 'fits' or 'hdf5'
time_bins: 2659985.0 # time bin size in seconds. Takes int, float, or list of bin edges.
energy_bins: [100., 1000., 10000.] # Takes list. Needs to match response.
phi_pix_size: 45 # binning of Compton scattering anlge [deg]
nside: 1 # healpix binning of psi chi local
scheme: 'ring' # healpix binning of psi chi local
tmin: 1835487300.0 # Min time cut in seconds.
tmax: 1843467255.0 # Max time cut in seconds.
#----------#
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

def test_continuum_background_estimation():


instance = ContinuumEstimation()

# Test main method:
#data_file = test_data.path / "bkg_pl.h5"
data_file = "/project/majello/astrohe/ckarwin/COSI/COSIpy_Development/Continuum_BG_Estimation/Run_8/crab_bkg_binned_data_galactic.hdf5"
data_yaml = test_data.path / "inputs_crab.yaml"
#psr_file = test_data.path / "test_precomputed_response.h5"
psr_file = "/project/majello/astrohe/ckarwin/COSI/COSIpy_Development/Continuum_BG_Estimation/Run_8/crab_psr.h5"
data_yaml = test_data.path / "inputs_crab_continuum_bg_estimation_testing.yaml"
data_file = test_data.path / "crab_bkg_binned_data_for_continuum_bg_testing.hdf5"
psr_file = test_data.path / "test_precomputed_response.h5"
psr = instance.load_psr_from_file(psr_file)
instance.continuum_bg_estimation(data_file, data_yaml, psr, e_loop=(2,3), s_loop=(4,5))

instance.continuum_bg_estimation(data_file, data_yaml, psr, e_loop=(1,2), s_loop=(1,2))

0 comments on commit f280b1d

Please sign in to comment.