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") | |
| 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 28 of file lalinference_compute_roq_weights.py.
| def lalinference_compute_roq_weights.ehat | ( | j, | |
| length | |||
| ) |
Return a unit vector whose j-th component is 1.
Definition at line 61 of file lalinference_compute_roq_weights.py.
| def lalinference_compute_roq_weights.DEIM | ( | basis | ) |
Calculate interpolation nodes following the Algorithm 5 in J Sci Comput (2013) 57:604-637.
basis : ndarray ndarray whose i-th row is the i-th basis vector
nodes : array interpolation nodes B : ndarray ndarray whose i-th row is the weight for the i-th frequency node.
Definition at line 81 of file lalinference_compute_roq_weights.py.
| 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.
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
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 141 of file lalinference_compute_roq_weights.py.
| 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 259 of file lalinference_compute_roq_weights.py.
| string lalinference_compute_roq_weights.data_dir = './' |
Definition at line 173 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.parser |
Definition at line 176 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.type |
Definition at line 178 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.action |
Definition at line 179 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.dest |
Definition at line 180 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.help |
Definition at line 181 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.default |
Definition at line 221 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.options |
Definition at line 224 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.args |
Definition at line 224 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.basis_params = np.loadtxt(os.path.join(options.b_matrix_directory, "params.dat")).T |
Definition at line 226 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.flow_in_params |
Definition at line 227 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fhigh_in_params |
Definition at line 227 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.deltaF_in_params |
Definition at line 227 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.B_linear_path = os.path.join(options.b_matrix_directory, "B_linear.npy") |
Definition at line 229 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.B_quadratic_path = os.path.join(options.b_matrix_directory, "B_quadratic.npy") |
Definition at line 230 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fnodes_linear_path = os.path.join(options.b_matrix_directory, "fnodes_linear.npy") |
Definition at line 231 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fnodes_quadratic_path = os.path.join(options.b_matrix_directory, "fnodes_quadratic.npy") |
Definition at line 232 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.params_linear_path = os.path.join(options.b_matrix_directory, "selected_params_linear.npy") |
Definition at line 233 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.params_quadratic_path = os.path.join(options.b_matrix_directory, "selected_params_quadratic.npy") |
Definition at line 234 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.B_linear = np.load(B_linear_path) |
Definition at line 237 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.B_quadratic = np.load(B_quadratic_path) |
Definition at line 238 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fnodes_linear = np.load(fnodes_linear_path) |
Definition at line 239 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fnodes_quadratic = np.load(fnodes_quadratic_path) |
Definition at line 240 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.selected_params_linear = np.load(params_linear_path) |
Definition at line 242 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.selected_params_quadratic = np.load(params_quadratic_path) |
Definition at line 243 of file lalinference_compute_roq_weights.py.
| int lalinference_compute_roq_weights.relative_tc_shift = options.seglen - 2. |
Definition at line 266 of file lalinference_compute_roq_weights.py.
| int lalinference_compute_roq_weights.i = 0 |
Definition at line 270 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.scale_factor = 0 |
Definition at line 271 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.dat_file = np.column_stack( np.loadtxt(options.data_file[i]) ) |
Definition at line 275 of file lalinference_compute_roq_weights.py.
Definition at line 276 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fseries = dat_file[0] |
Definition at line 277 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.deltaF = 1./options.seglen |
Definition at line 279 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fHigh = options.fHigh |
Definition at line 283 of file lalinference_compute_roq_weights.py.
Definition at line 286 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fLow = options.fLow |
Definition at line 291 of file lalinference_compute_roq_weights.py.
Definition at line 297 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.psdfile = np.column_stack( np.loadtxt(options.psd_file[i]) ) |
Definition at line 304 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.psd = psdfile[1] |
Definition at line 305 of file lalinference_compute_roq_weights.py.
| 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 328 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.tc_shifted_data = np.zeros([len(tcs), len(fseries)], dtype=complex) |
Definition at line 331 of file lalinference_compute_roq_weights.py.
Definition at line 336 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.weights_path_linear = os.path.join(options.outpath,"weights_linear_%s.dat"%ifo) |
Definition at line 348 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.weights_file_linear = open(weights_path_linear, "wb") |
Definition at line 349 of file lalinference_compute_roq_weights.py.
| int lalinference_compute_roq_weights.max_block_gigabytes = 4 |
Definition at line 351 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.max_elements = int((max_block_gigabytes * 2 ** 30) / 8) |
Definition at line 352 of file lalinference_compute_roq_weights.py.
| def lalinference_compute_roq_weights.weights_linear = blockwise_dot(tc_shifted_data, B_linear.conjugate(), deltaF, max_elements).T |
Definition at line 354 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.weights_path_quadratic = os.path.join(options.outpath,"weights_quadratic_%s.dat"%ifo) |
Definition at line 362 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.weights_file_quadratic = open(weights_path_quadratic, "wb") |
Definition at line 363 of file lalinference_compute_roq_weights.py.
| tuple lalinference_compute_roq_weights.weights_quadratic = (BuildWeights(1./psd, B_quadratic, deltaF).T).real |
Definition at line 364 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.size_file_path = os.path.join(options.outpath,"roq_sizes.dat") |
Definition at line 368 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fmt |
Definition at line 375 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fnodes_linear_file = open(fnodes_linear_path, "wb") |
Definition at line 389 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.fnodes_quadratic_file = open(fnodes_quadratic_path, "wb") |
Definition at line 395 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.tcs_file_path = os.path.join(options.outpath,"tcs.dat") |
Definition at line 400 of file lalinference_compute_roq_weights.py.
| lalinference_compute_roq_weights.tcs_file = open(tcs_file_path, "wb") |
Definition at line 401 of file lalinference_compute_roq_weights.py.