Skip to content
Snippets Groups Projects
Commit 20a52183 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Merge branch 'timeFstatmap' into 'master'

internal timing of transient F-stat map function

See merge request GregAshton/PyFstat!16
parents fe49dcba a763d572
Branches
Tags
No related merge requests found
...@@ -714,7 +714,7 @@ class ComputeFstat(BaseSearchClass): ...@@ -714,7 +714,7 @@ class ComputeFstat(BaseSearchClass):
# actual (t0,tau) window was set with tstart, tend before # actual (t0,tau) window was set with tstart, tend before
self.windowRange.tau = int(tend - tstart) # TYPE UINT4 self.windowRange.tau = int(tend - tstart) # TYPE UINT4
self.FstatMap = tcw.call_compute_transient_fstat_map( self.FstatMap, self.timingFstatMap = tcw.call_compute_transient_fstat_map(
self.tCWFstatMapVersion, self.tCWFstatMapFeatures, self.tCWFstatMapVersion, self.tCWFstatMapFeatures,
self.FstatResults.multiFatoms[0], self.windowRange) self.FstatResults.multiFatoms[0], self.windowRange)
if self.tCWFstatMapVersion == 'lal': if self.tCWFstatMapVersion == 'lal':
......
...@@ -459,10 +459,12 @@ class TransientGridSearch(GridSearch): ...@@ -459,10 +459,12 @@ class TransientGridSearch(GridSearch):
tCWfilebase = os.path.splitext(self.out_file)[0] + '_tCW_' tCWfilebase = os.path.splitext(self.out_file)[0] + '_tCW_'
logging.info('Will save per-Doppler Fstatmap' \ logging.info('Will save per-Doppler Fstatmap' \
' results to {}*.dat'.format(tCWfilebase)) ' results to {}*.dat'.format(tCWfilebase))
self.timingFstatMap = 0.
for vals in tqdm(self.input_data): for vals in tqdm(self.input_data):
detstat = self.search.get_det_stat(*vals) detstat = self.search.get_det_stat(*vals)
windowRange = getattr(self.search, 'windowRange', None) windowRange = getattr(self.search, 'windowRange', None)
FstatMap = getattr(self.search, 'FstatMap', None) FstatMap = getattr(self.search, 'FstatMap', None)
self.timingFstatMap += getattr(self.search, 'timingFstatMap', None)
thisCand = list(vals) + [detstat] thisCand = list(vals) + [detstat]
if getattr(self, 'transientWindowType', None): if getattr(self, 'transientWindowType', None):
if self.tCWFstatMapVersion == 'lal': if self.tCWFstatMapVersion == 'lal':
...@@ -491,6 +493,8 @@ class TransientGridSearch(GridSearch): ...@@ -491,6 +493,8 @@ class TransientGridSearch(GridSearch):
if self.outputAtoms: if self.outputAtoms:
self.search.write_atoms_to_file(os.path.splitext(self.out_file)[0]) self.search.write_atoms_to_file(os.path.splitext(self.out_file)[0])
logging.info('Total time spent computing transient F-stat maps: {:.2f}s'.format(self.timingFstatMap))
data = np.array(data, dtype=np.float) data = np.array(data, dtype=np.float)
if return_data: if return_data:
return data return data
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import numpy as np import numpy as np
import os import os
import logging import logging
from time import time
# optional imports # optional imports
import importlib as imp import importlib as imp
...@@ -185,14 +186,16 @@ def call_compute_transient_fstat_map ( version, ...@@ -185,14 +186,16 @@ def call_compute_transient_fstat_map ( version,
if version in fstatmap_versions: if version in fstatmap_versions:
if features[version]: if features[version]:
time0 = time()
FstatMap = fstatmap_versions[version](multiFstatAtoms, windowRange) FstatMap = fstatmap_versions[version](multiFstatAtoms, windowRange)
timingFstatMap = time()-time0
else: else:
raise Exception('Required module(s) for transient F-stat map' \ raise Exception('Required module(s) for transient F-stat map' \
' method "{}" not available!'.format(version)) ' method "{}" not available!'.format(version))
else: else:
raise Exception('Transient F-stat map method "{}"' \ raise Exception('Transient F-stat map method "{}"' \
' not implemented!'.format(version)) ' not implemented!'.format(version))
return FstatMap return FstatMap, timingFstatMap
def reshape_FstatAtomsVector ( atomsVector ): def reshape_FstatAtomsVector ( atomsVector ):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment