-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_expectation.py
33 lines (29 loc) · 1.12 KB
/
generate_expectation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
import os, argparse
import cPickle as pickle
import numpy as np
from data_types import LocalWarmSpotExpectation
parser = argparse.ArgumentParser()
parser.add_argument("--infiles",
type=str,
nargs='+',
default=["test_data/extracted_background_populations/all_sky_population_bgd_trial_test.pickle"],
help="List of input files. Input files should contain a list of extracted background populations.")
parser.add_argument("--outfile",
type=str,
default="test_data/from_poisson_test/HPA_nspot_expectation.pickle",
help="Path of the output folder.")
args = parser.parse_args()
print "Run", os.path.realpath(__file__)
print "Use arguments:", args
print
# read in all sky trials
trials = []
for file_name in args.infiles:
with open(file_name, "r") as open_file:
temp = pickle.load(open_file)
trials.extend(temp)
print "Read in %d trials"%len(trials)
expectation = LocalWarmSpotExpectation()
expectation.generate(trials, np.linspace(2,7, 5*10+1))
expectation.save(args.outfile)