Skip to content

Commit

Permalink
quick autopower code running; starting to make bulk sims for autopower
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-switzer committed Oct 14, 2012
1 parent 1617865 commit 75e0bfe
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions input/ers/autopower/GBT_15hr_map_oldcal.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ from map import simulate_gbt
from foreground_clean import pair_set
from quadratic_products import pwrspec_combinations
from quadratic_products import pwrspec_compile
import struct
import os

#-----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion map/simulate_gbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ def subtract_mean(self):

self.sim_map_meansub = copy.deepcopy(self.sim_map_withbeam)
print "sim meansub using: " + self.params['weightfile']
noise_inv = algebra.make_vect(algebra.load(self.params['weightfile']))
noise_inv = self.datapath_db.fetch_multi(self.params['weightfile'])
#noise_inv = algebra.make_vect(algebra.load(self.params['weightfile']))
means = np.sum(np.sum(noise_inv * self.sim_map_meansub, -1), -1)
means /= np.sum(np.sum(noise_inv, -1), -1)
means.shape += (1, 1)
Expand Down
1 change: 1 addition & 0 deletions pwrspec_plots/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this directory is for outputs of the power spectrum analysis
10 changes: 8 additions & 2 deletions quadratic_products/pwrspec_combinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def phys_pwrspec_caller(cube1_file, cube2_file, params):

gbtdataautopower_init = {
"map_key": "test_map",
"tack_on": None,
"outfile": "test_file.shelve",
"unitless": True,
"return_3d": False,
Expand Down Expand Up @@ -101,6 +102,7 @@ def execute(self, processes):
caller = aggregate_outputs.AggregateOutputs(funcname)

map_key = self.params['map_key']
tack_on = self.params['tack_on']
map_cases = self.datapath_db.fileset_cases(map_key,
"pair;type;treatment")

Expand All @@ -118,7 +120,8 @@ def execute(self, processes):
dbkeydict['noiseinv1_key'] = "%s:%s;noise_inv;%s" % mapset0
dbkeydict['noiseinv2_key'] = "%s:%s;noise_inv;%s" % mapset1
files = dp.convert_dbkeydict_to_filedict(dbkeydict,
datapath_db=self.datapath_db)
datapath_db=self.datapath_db
tack_on=tack_on)

execute_key = "%s:%s" % (item[0], treatment)
caller.execute(files['map1_key'],
Expand All @@ -133,6 +136,7 @@ def execute(self, processes):

gbtdatanoisepower_init = {
"map_key": "test_map",
"tack_on": None,
"outfile": "test_file.shelve",
"unitless": True,
"return_3d": False,
Expand Down Expand Up @@ -169,6 +173,7 @@ def execute(self, processes):
caller = aggregate_outputs.AggregateOutputs(funcname)

map_key = self.params['map_key']
tack_on = self.params['tack_on']
map_cases = self.datapath_db.fileset_cases(map_key,
"pair;type;treatment")

Expand All @@ -191,7 +196,8 @@ def execute(self, processes):
dbkeydict['noiseinv1_key'] = "%s:%s;noise_inv;%s" % mapset0
dbkeydict['noiseinv2_key'] = "%s:%s;noise_inv;%s" % mapset1
files = dp.convert_dbkeydict_to_filedict(dbkeydict,
datapath_db=self.datapath_db)
datapath_db=self.datapath_db,
tack_on=tack_on)

execute_key = "%s:%s" % (item, treatment)
caller.execute(files['map1_key'],
Expand Down
6 changes: 4 additions & 2 deletions utils/data_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ def unpack_cases(case_list, case_key, divider=";"):
return case_counter


def convert_dbkeydict_to_filedict(dbkeydict, datapath_db=None, silent=True):
def convert_dbkeydict_to_filedict(dbkeydict, datapath_db=None, silent=True,
tack_on=None):
r"""simple caller to convert a dictionary of database keys to a dictionary
of filenames"""
if datapath_db is None:
datapath_db = DataPath()

filedict = {}
for name in dbkeydict:
filedict[name] = datapath_db.fetch(dbkeydict[name], silent=silent)
filedict[name] = datapath_db.fetch(dbkeydict[name], silent=silent,
tack_on=tack_on)

return filedict

Expand Down

0 comments on commit 75e0bfe

Please sign in to comment.