-
Notifications
You must be signed in to change notification settings - Fork 371
Quadtratic modes #5198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Quadtratic modes #5198
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [workflow] | ||
|
|
||
| [executables] | ||
| exe1 = /usr/bin/cp | ||
|
|
||
| [exe1] | ||
|
|
||
| [pegasus_profile] | ||
| pycbc|submit-directory = ./ |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| """ A minimal pycbc workflow example """ | ||
|
|
||
| import argparse | ||
| import pycbc | ||
| import pycbc.workflow as wf | ||
| import os | ||
|
|
||
| pycbc.init_logging(True) | ||
| parser = argparse.ArgumentParser(description=__doc__[1:]) | ||
| parser.add_argument("--multilevel", action='store_true', default=False) | ||
| wf.add_workflow_command_line_group(parser) | ||
| wf.add_workflow_settings_cli(parser) | ||
| args = parser.parse_args() | ||
|
|
||
| input_file = wf.resolve_url_to_file("test_input.txt") | ||
| input_file.add_pfn(os.path.abspath('./test_input.txt'), 'local') | ||
|
|
||
| cont = wf.Workflow(args, 'cont') | ||
| sub1 = wf.Workflow(args, 'sub1') | ||
| sub1_1 = wf.Workflow(args, 'sub1_1') | ||
| sub2 = wf.Workflow(args, 'sub2') | ||
|
|
||
| exe1 = wf.Executable(cont.cp, 'exe1') | ||
|
|
||
| SUBSUB = args.multilevel | ||
|
|
||
| # Subworkflow 1: generate file that will be needed later | ||
|
|
||
| # PATH1: generate that input in a sub-sub workflow | ||
| if SUBSUB: | ||
| # Subworkflow 1: sub-subworkflow | ||
| node = exe1.create_node() | ||
| wf1_out_file = wf.File.from_path(os.path.abspath("test_output.txt.2")) | ||
| node.add_input_arg(input_file) | ||
| node.add_output_arg(wf1_out_file) | ||
| sub1_1 += node | ||
| sub1 += sub1_1 | ||
|
|
||
| #PATH2: generate that input within a sub-workflow | ||
| else: | ||
| node = exe1.create_node() | ||
| wf1_out_file = wf.File.from_path(os.path.abspath("test_output.txt.2")) | ||
| node.add_input_arg(input_file) | ||
| node.add_output_arg(wf1_out_file) | ||
| sub1 += node | ||
|
|
||
| # Subworkflow 2 | ||
| # TEST GOAL: Job within subworkflow gets the input file produce in | ||
| # some external workflow | ||
| node2 = exe1.create_node() | ||
| node2.add_input_arg(wf1_out_file) | ||
| node2.add_output_arg(wf.File.from_path(os.path.abspath("test_output.txt.3"))) | ||
| sub2 += node2 | ||
|
|
||
| # Regular job in top-level workflow | ||
| # Test GOAL: job *directly* in workflow gets file produced by subworkflow in | ||
| # the same workflow | ||
| node2 = exe1.create_node() | ||
| node2.add_input_arg(wf1_out_file) | ||
| node2.add_output_arg(wf.File.from_path(os.path.abspath("test_output.txt.4"))) | ||
| cont += node2 | ||
|
|
||
| cont += sub1 | ||
| cont += sub2 | ||
| cont.save() |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| [model] | ||
| name = single_template | ||
|
|
||
| #; This model precalculates the SNR time series at a fixed rate. | ||
| #; If you need a higher time resolution, this may be increased | ||
| sample_rate = 32768 | ||
| low-frequency-cutoff = 30.0 | ||
|
|
||
| [data] | ||
| instruments = H1 L1 V1 | ||
| analysis-start-time = 1187008482 | ||
| analysis-end-time = 1187008892 | ||
| psd-estimation = median | ||
| psd-segment-length = 16 | ||
| psd-segment-stride = 8 | ||
| psd-inverse-length = 16 | ||
| pad-data = 8 | ||
| channel-name = H1:LOSC-STRAIN L1:LOSC-STRAIN V1:LOSC-STRAIN | ||
| frame-files = H1:H-H1_LOSC_CLN_4_V1-1187007040-2048.gwf L1:L-L1_LOSC_CLN_4_V1-1187007040-2048.gwf V1:V-V1_LOSC_CLN_4_V1-1187007040-2048.gwf | ||
| strain-high-pass = 15 | ||
| sample-rate = 2048 | ||
|
|
||
| [sampler] | ||
| name = dynesty | ||
| sample = rwalk | ||
| bound = multi | ||
| dlogz = 0.1 | ||
| nlive = 200 | ||
| checkpoint_time_interval = 100 | ||
| maxcall = 10000 | ||
|
|
||
| [variable_params] | ||
| ; waveform parameters that will vary in MCMC | ||
| tc = | ||
| distance = | ||
| inclination = | ||
|
|
||
| [static_params] | ||
| ; waveform parameters that will not change in MCMC | ||
| approximant = TaylorF2 | ||
| f_lower = 30 | ||
| mass1 = 1.3757 | ||
| mass2 = 1.3757 | ||
|
|
||
| #; we'll choose not to sample over these, but you could | ||
| polarization = 0 | ||
| ra = 3.44615914 | ||
| dec = -0.40808407 | ||
|
|
||
| #; You could also set additional parameters if your waveform model supports / requires it. | ||
| ; spin1z = 0 | ||
|
|
||
| [prior-tc] | ||
| ; coalescence time prior | ||
| name = uniform | ||
| min-tc = 1187008882.4 | ||
| max-tc = 1187008882.5 | ||
|
|
||
| [prior-distance] | ||
| #; following gives a uniform in volume | ||
| name = uniform_radius | ||
| min-distance = 10 | ||
| max-distance = 60 | ||
|
|
||
| [prior-inclination] | ||
| name = sin_angle |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1198,6 +1198,47 @@ def get_lm_f0tau_allmodes(mass, spin, modes): | |
| tau[key.format(l, abs(m), n)] = tmp_tau | ||
| return f0, tau | ||
|
|
||
| def get_qlm_f0tau_allmodes(mass, spin, qmodes): | ||
| """Returns a dictionary of all of the frequencies and damping times for the | ||
| requested modes. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| mass : float or array | ||
| Mass of the black hole (in solar masses). | ||
| spin : float or array | ||
| Dimensionless spin of the final black hole. | ||
| qmodes : list of str | ||
| The modes to get. Each string in the list should be formatted | ||
| 'qlmN', where l (m) is the l (m) index of the | ||
| harmonic and N is the number of overtones to generate (note, N is not | ||
| the index of the overtone). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said above, I think it more sense with the quadratic lmns to explicitly specify the overtone number, rather than make N the number of modes.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, as I pointed out there. Should I just change the quadratic mode overtone number? So if we had 442=222x222, I would have to change the code such that 222 corresponds to 221 in the new syntax, and not 220+221. |
||
|
|
||
| Returns | ||
| ------- | ||
| f0 : dict | ||
| Dictionary mapping the modes to the frequencies. The dictionary keys | ||
| are 'qlmn' string, where l (m) is the l (m) index of the harmonic and | ||
| n is the index of the overtone. For example, '220' is the l = m = 2 | ||
| mode and the 0th overtone. | ||
| tau : dict | ||
| Dictionary mapping the modes to the damping times. The keys are the | ||
| same as ``f0``. | ||
| """ | ||
| f0, tau = {}, {} | ||
| for qlmn, lmn1, lmn2 in qmodes: | ||
| key = '{}{}{}' | ||
| l1, m1, nmodes1 = int(lmn1[0]), int(lmn1[1]), int(lmn1[2]) | ||
| l2, m2, nmodes2 = int(lmn2[0]), int(lmn2[1]), int(lmn2[2]) | ||
| ql, qm, qnmodes = int(qlmn[0]), int(qlmn[1]), int(qlmn[2]) | ||
| for qn in range(qnmodes): | ||
| for n1 in range(nmodes1): | ||
| for n2 in range(nmodes2): | ||
| tmp_f01, tmp_tau1 = get_lm_f0tau(mass, spin, l1, m1, n1) | ||
| tmp_f02, tmp_tau2 = get_lm_f0tau(mass, spin, l2, m2, n2) | ||
| f0[key.format(ql, abs(qm), qn)] = tmp_f01 + tmp_f02 | ||
| tau[key.format(ql, abs(qm), qn)] = (tmp_tau1 * tmp_tau2) / (tmp_tau1 + tmp_tau2) | ||
| return f0, tau | ||
|
|
||
| def freq_from_final_mass_spin(final_mass, final_spin, l=2, m=2, n=0): | ||
| """Returns QNM frequency for the given mass and spin and mode. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, make explicit what the
qstands for in the doc string.