LALInference  4.1.6.1-b72065a
lalinference_compute_roq_weights Namespace Reference

Functions

def blockwise_dot (A, B, deltaF, max_elements=int(2 **27), out=None)
 Computes the dot product of two matrices in a block-wise fashion. More...
 
def ehat (j, length)
 Return a unit vector whose j-th component is 1. More...
 
def DEIM (basis)
 Calculate interpolation nodes following the Algorithm 5 in J Sci Comput (2013) 57:604-637. More...
 
def construct_nodes (selected_params, flow, fhigh, deltaF, approximant, quadratic)
 Construct frequency nodes and weights from parameter values selected by greedy algorithm. More...
 
def BuildWeights (data, B, deltaF)
 for a data array and reduced basis compute roq weights More...
 

Variables

string data_dir = './'
 
 parser
 
 type
 
 action
 
 dest
 
 help
 
 default
 
 options
 
 args
 
 basis_params = np.loadtxt(os.path.join(options.b_matrix_directory, "params.dat")).T
 
 flow_in_params
 
 fhigh_in_params
 
 deltaF_in_params
 
 B_linear_path = os.path.join(options.b_matrix_directory, "B_linear.npy")
 
 B_quadratic_path = os.path.join(options.b_matrix_directory, "B_quadratic.npy")
 
 fnodes_linear_path = os.path.join(options.b_matrix_directory, "fnodes_linear.npy")
 
 fnodes_quadratic_path = os.path.join(options.b_matrix_directory, "fnodes_quadratic.npy")
 
 params_linear_path = os.path.join(options.b_matrix_directory, "selected_params_linear.npy")
 
 params_quadratic_path = os.path.join(options.b_matrix_directory, "selected_params_quadratic.npy")
 
 B_linear = np.load(B_linear_path)
 
 B_quadratic = np.load(B_quadratic_path)
 
 fnodes_linear = np.load(fnodes_linear_path)
 
 fnodes_quadratic = np.load(fnodes_quadratic_path)
 
 selected_params_linear = np.load(params_linear_path)
 
 selected_params_quadratic = np.load(params_quadratic_path)
 
int relative_tc_shift = options.seglen - 2.
 
int i = 0
 
int scale_factor = 0
 
 dat_file = np.column_stack( np.loadtxt(options.data_file[i]) )
 
int data = dat_file[1] + 1j*dat_file[2]
 
 fseries = dat_file[0]
 
int deltaF = 1./options.seglen
 
 fHigh = options.fHigh
 
 fHigh_index = int(fHigh / deltaF)
 
 fLow = options.fLow
 
 fLow_index = int(fLow / deltaF)
 
 psdfile = np.column_stack( np.loadtxt(options.psd_file[i]) )
 
 psd = psdfile[1]
 
 tcs = np.linspace(relative_tc_shift - options.dt - 0.045, relative_tc_shift + options.dt + 0.045, ceil(2.*(options.dt+0.045) / options.delta_tc) )
 
 tc_shifted_data = np.zeros([len(tcs), len(fseries)], dtype=complex)
 
 tc = tcs[j]
 
 weights_path_linear = os.path.join(options.outpath,"weights_linear_%s.dat"%ifo)
 
 weights_file_linear = open(weights_path_linear, "wb")
 
int max_block_gigabytes = 4
 
 max_elements = int((max_block_gigabytes * 2 ** 30) / 8)
 
def weights_linear = blockwise_dot(tc_shifted_data, B_linear.conjugate(), deltaF, max_elements).T
 
 weights_path_quadratic = os.path.join(options.outpath,"weights_quadratic_%s.dat"%ifo)
 
 weights_file_quadratic = open(weights_path_quadratic, "wb")
 
tuple weights_quadratic = (BuildWeights(1./psd, B_quadratic, deltaF).T).real
 
 size_file_path = os.path.join(options.outpath,"roq_sizes.dat")
 
 fmt
 
 fnodes_linear_file = open(fnodes_linear_path, "wb")
 
 fnodes_quadratic_file = open(fnodes_quadratic_path, "wb")
 
 tcs_file_path = os.path.join(options.outpath,"tcs.dat")
 
 tcs_file = open(tcs_file_path, "wb")
 

Function Documentation

◆ blockwise_dot()

def lalinference_compute_roq_weights.blockwise_dot (   A,
  B,
  deltaF,
  max_elements = int(2**27),
  out = None 
)

Computes the dot product of two matrices in a block-wise fashion.

Only blocks of A with a maximum size of max_elements will be processed simultaneously.

Definition at line 27 of file lalinference_compute_roq_weights.py.

◆ ehat()

def lalinference_compute_roq_weights.ehat (   j,
  length 
)

Return a unit vector whose j-th component is 1.

Definition at line 60 of file lalinference_compute_roq_weights.py.

◆ DEIM()

def lalinference_compute_roq_weights.DEIM (   basis)

Calculate interpolation nodes following the Algorithm 5 in J Sci Comput (2013) 57:604-637.

Parameters

basis : ndarray ndarray whose i-th row is the i-th basis vector

Return

nodes : array interpolation nodes B : ndarray ndarray whose i-th row is the weight for the i-th frequency node.

Definition at line 80 of file lalinference_compute_roq_weights.py.

◆ construct_nodes()

def lalinference_compute_roq_weights.construct_nodes (   selected_params,
  flow,
  fhigh,
  deltaF,
  approximant,
  quadratic 
)

Construct frequency nodes and weights from parameter values selected by greedy algorithm.

Parameters

selected_params : ndarray rray whose i-th row is the i-th parameter set selected by greedy algorithm flow : float fhigh : float deltaF : float approximant : string quadratic : bool construct nodes for products of waveforms when this is True

Return

f_nodes : ndarray interpolation frequency nodes B : ndarray ndarray whose i-th roq is the weight for the i-th frequency node.

Definition at line 140 of file lalinference_compute_roq_weights.py.

◆ BuildWeights()

def lalinference_compute_roq_weights.BuildWeights (   data,
  B,
  deltaF 
)

for a data array and reduced basis compute roq weights

B: (reduced basis element)*invV (the inverse Vandermonde matrix) data: data set PSD: detector noise power spectral density (must be same shape as data) deltaF: integration element df

Definition at line 258 of file lalinference_compute_roq_weights.py.

Variable Documentation

◆ data_dir

string lalinference_compute_roq_weights.data_dir = './'

Definition at line 172 of file lalinference_compute_roq_weights.py.

◆ parser

lalinference_compute_roq_weights.parser
Initial value:
1 = OptionParser(usage="usage: %prog [options]",
2  version="%prog")

Definition at line 175 of file lalinference_compute_roq_weights.py.

◆ type

lalinference_compute_roq_weights.type

Definition at line 177 of file lalinference_compute_roq_weights.py.

◆ action

lalinference_compute_roq_weights.action

Definition at line 178 of file lalinference_compute_roq_weights.py.

◆ dest

lalinference_compute_roq_weights.dest

Definition at line 179 of file lalinference_compute_roq_weights.py.

◆ help

lalinference_compute_roq_weights.help

Definition at line 180 of file lalinference_compute_roq_weights.py.

◆ default

lalinference_compute_roq_weights.default

Definition at line 220 of file lalinference_compute_roq_weights.py.

◆ options

lalinference_compute_roq_weights.options

Definition at line 223 of file lalinference_compute_roq_weights.py.

◆ args

lalinference_compute_roq_weights.args

Definition at line 223 of file lalinference_compute_roq_weights.py.

◆ basis_params

lalinference_compute_roq_weights.basis_params = np.loadtxt(os.path.join(options.b_matrix_directory, "params.dat")).T

Definition at line 225 of file lalinference_compute_roq_weights.py.

◆ flow_in_params

lalinference_compute_roq_weights.flow_in_params

Definition at line 226 of file lalinference_compute_roq_weights.py.

◆ fhigh_in_params

lalinference_compute_roq_weights.fhigh_in_params

Definition at line 226 of file lalinference_compute_roq_weights.py.

◆ deltaF_in_params

lalinference_compute_roq_weights.deltaF_in_params

Definition at line 226 of file lalinference_compute_roq_weights.py.

◆ B_linear_path

lalinference_compute_roq_weights.B_linear_path = os.path.join(options.b_matrix_directory, "B_linear.npy")

Definition at line 228 of file lalinference_compute_roq_weights.py.

◆ B_quadratic_path

lalinference_compute_roq_weights.B_quadratic_path = os.path.join(options.b_matrix_directory, "B_quadratic.npy")

Definition at line 229 of file lalinference_compute_roq_weights.py.

◆ fnodes_linear_path

lalinference_compute_roq_weights.fnodes_linear_path = os.path.join(options.b_matrix_directory, "fnodes_linear.npy")

Definition at line 230 of file lalinference_compute_roq_weights.py.

◆ fnodes_quadratic_path

lalinference_compute_roq_weights.fnodes_quadratic_path = os.path.join(options.b_matrix_directory, "fnodes_quadratic.npy")

Definition at line 231 of file lalinference_compute_roq_weights.py.

◆ params_linear_path

lalinference_compute_roq_weights.params_linear_path = os.path.join(options.b_matrix_directory, "selected_params_linear.npy")

Definition at line 232 of file lalinference_compute_roq_weights.py.

◆ params_quadratic_path

lalinference_compute_roq_weights.params_quadratic_path = os.path.join(options.b_matrix_directory, "selected_params_quadratic.npy")

Definition at line 233 of file lalinference_compute_roq_weights.py.

◆ B_linear

lalinference_compute_roq_weights.B_linear = np.load(B_linear_path)

Definition at line 236 of file lalinference_compute_roq_weights.py.

◆ B_quadratic

lalinference_compute_roq_weights.B_quadratic = np.load(B_quadratic_path)

Definition at line 237 of file lalinference_compute_roq_weights.py.

◆ fnodes_linear

lalinference_compute_roq_weights.fnodes_linear = np.load(fnodes_linear_path)

Definition at line 238 of file lalinference_compute_roq_weights.py.

◆ fnodes_quadratic

lalinference_compute_roq_weights.fnodes_quadratic = np.load(fnodes_quadratic_path)

Definition at line 239 of file lalinference_compute_roq_weights.py.

◆ selected_params_linear

lalinference_compute_roq_weights.selected_params_linear = np.load(params_linear_path)

Definition at line 241 of file lalinference_compute_roq_weights.py.

◆ selected_params_quadratic

lalinference_compute_roq_weights.selected_params_quadratic = np.load(params_quadratic_path)

Definition at line 242 of file lalinference_compute_roq_weights.py.

◆ relative_tc_shift

int lalinference_compute_roq_weights.relative_tc_shift = options.seglen - 2.

Definition at line 265 of file lalinference_compute_roq_weights.py.

◆ i

int lalinference_compute_roq_weights.i = 0

Definition at line 269 of file lalinference_compute_roq_weights.py.

◆ scale_factor

lalinference_compute_roq_weights.scale_factor = 0

Definition at line 270 of file lalinference_compute_roq_weights.py.

◆ dat_file

lalinference_compute_roq_weights.dat_file = np.column_stack( np.loadtxt(options.data_file[i]) )

Definition at line 274 of file lalinference_compute_roq_weights.py.

◆ data

int lalinference_compute_roq_weights.data = dat_file[1] + 1j*dat_file[2]

Definition at line 275 of file lalinference_compute_roq_weights.py.

◆ fseries

lalinference_compute_roq_weights.fseries = dat_file[0]

Definition at line 276 of file lalinference_compute_roq_weights.py.

◆ deltaF

lalinference_compute_roq_weights.deltaF = 1./options.seglen

Definition at line 278 of file lalinference_compute_roq_weights.py.

◆ fHigh

lalinference_compute_roq_weights.fHigh = options.fHigh

Definition at line 282 of file lalinference_compute_roq_weights.py.

◆ fHigh_index

lalinference_compute_roq_weights.fHigh_index = int(fHigh / deltaF)

Definition at line 285 of file lalinference_compute_roq_weights.py.

◆ fLow

lalinference_compute_roq_weights.fLow = options.fLow

Definition at line 290 of file lalinference_compute_roq_weights.py.

◆ fLow_index

lalinference_compute_roq_weights.fLow_index = int(fLow / deltaF)

Definition at line 296 of file lalinference_compute_roq_weights.py.

◆ psdfile

lalinference_compute_roq_weights.psdfile = np.column_stack( np.loadtxt(options.psd_file[i]) )

Definition at line 303 of file lalinference_compute_roq_weights.py.

◆ psd

lalinference_compute_roq_weights.psd = psdfile[1]

Definition at line 304 of file lalinference_compute_roq_weights.py.

◆ tcs

lalinference_compute_roq_weights.tcs = np.linspace(relative_tc_shift - options.dt - 0.045, relative_tc_shift + options.dt + 0.045, ceil(2.*(options.dt+0.045) / options.delta_tc) )

Definition at line 327 of file lalinference_compute_roq_weights.py.

◆ tc_shifted_data

lalinference_compute_roq_weights.tc_shifted_data = np.zeros([len(tcs), len(fseries)], dtype=complex)

Definition at line 330 of file lalinference_compute_roq_weights.py.

◆ tc

lalinference_compute_roq_weights.tc = tcs[j]

Definition at line 335 of file lalinference_compute_roq_weights.py.

◆ weights_path_linear

lalinference_compute_roq_weights.weights_path_linear = os.path.join(options.outpath,"weights_linear_%s.dat"%ifo)

Definition at line 347 of file lalinference_compute_roq_weights.py.

◆ weights_file_linear

lalinference_compute_roq_weights.weights_file_linear = open(weights_path_linear, "wb")

Definition at line 348 of file lalinference_compute_roq_weights.py.

◆ max_block_gigabytes

int lalinference_compute_roq_weights.max_block_gigabytes = 4

Definition at line 350 of file lalinference_compute_roq_weights.py.

◆ max_elements

lalinference_compute_roq_weights.max_elements = int((max_block_gigabytes * 2 ** 30) / 8)

Definition at line 351 of file lalinference_compute_roq_weights.py.

◆ weights_linear

def lalinference_compute_roq_weights.weights_linear = blockwise_dot(tc_shifted_data, B_linear.conjugate(), deltaF, max_elements).T

Definition at line 353 of file lalinference_compute_roq_weights.py.

◆ weights_path_quadratic

lalinference_compute_roq_weights.weights_path_quadratic = os.path.join(options.outpath,"weights_quadratic_%s.dat"%ifo)

Definition at line 361 of file lalinference_compute_roq_weights.py.

◆ weights_file_quadratic

lalinference_compute_roq_weights.weights_file_quadratic = open(weights_path_quadratic, "wb")

Definition at line 362 of file lalinference_compute_roq_weights.py.

◆ weights_quadratic

tuple lalinference_compute_roq_weights.weights_quadratic = (BuildWeights(1./psd, B_quadratic, deltaF).T).real

Definition at line 363 of file lalinference_compute_roq_weights.py.

◆ size_file_path

lalinference_compute_roq_weights.size_file_path = os.path.join(options.outpath,"roq_sizes.dat")

Definition at line 367 of file lalinference_compute_roq_weights.py.

◆ fmt

lalinference_compute_roq_weights.fmt

Definition at line 374 of file lalinference_compute_roq_weights.py.

◆ fnodes_linear_file

lalinference_compute_roq_weights.fnodes_linear_file = open(fnodes_linear_path, "wb")

Definition at line 388 of file lalinference_compute_roq_weights.py.

◆ fnodes_quadratic_file

lalinference_compute_roq_weights.fnodes_quadratic_file = open(fnodes_quadratic_path, "wb")

Definition at line 394 of file lalinference_compute_roq_weights.py.

◆ tcs_file_path

lalinference_compute_roq_weights.tcs_file_path = os.path.join(options.outpath,"tcs.dat")

Definition at line 399 of file lalinference_compute_roq_weights.py.

◆ tcs_file

lalinference_compute_roq_weights.tcs_file = open(tcs_file_path, "wb")

Definition at line 400 of file lalinference_compute_roq_weights.py.