-
Notifications
You must be signed in to change notification settings - Fork 348
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
Make gate-and-inpainting starting time precise #4403
Conversation
A visulization of waveform and data being shifted before and after can be found here: |
I launched two runs to estimate the kerr 220 ringdown mode with GW150914, one with this PR applied and one without. The result is here. They look close enough |
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.
This looks good. But can you put lines 563-575 into a separate function that can be called? Maybe make it a class method of BaseGatedGaussian
. That will make it easier to implement in the MarginalizedPolarization model. So, for example, in the GatedGaussian you would pass rtilde
to do the shift, while in the MarginalizedPolarization model you would pass hp, hc, and the data.
…ate-and-inpaint session
@cdcapano After a second thought, now I implement the "making the gating time precise" differently. All the inference's models are left untouched, the time shifting is only implemented in What the codes do is basicaly firstly shifting data to an earlier time by an amount equal to I test this PR by running GW150914's ringdown part with only 220 mode. This plot is a comparison of results with and without this PR applied. I see small but visible differences. |
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.
Just a few more changes, as we discussed on the call. Looks good otherwise.
@cdcapano all comments addressed. I tested with GW150914 with ringdown 220 (config file). This plot compares results with and without this PR. Without this PR, A_220 = 2.8E-21; while results with this PR reduce A_220 a little bit to 2.77E-21. I think this is expected, because a little bit more pre-ringdown data are gated by this PR, hence smaller A220. |
@ahnitz Collin and I would like to let you review this PR before merging, because it affects gate and inpainting everywhere. The idea is that the previous gating start and end time are not precise when it is located at a subsample time. Say the LIGO data are sampled at ..., t_-2, t_-1, t_0, t_1, ... and the gating end time is somewhere between t_0 and t_1, previous gate-and-inpainting would inpaint only until t_-1, sometime even t_-2 if the window length is not a integer times of 1/sampling rate. This PR effectively reconstruct the time domain data at epoch t_gate_end and t_gate_end plus/minus n times of 1/sampling rate, then inpaint until one element before the t_gate_end. The reconstruction is done by time shifting in frequency domain and then shifting back after inpainting. We think this makes the gating epoch more precise, this will affect the results of ringdown overtone analysis where the characteristic decay time is even less than 1 ms. |
…ieve the data sample time array
…used for debugging before
@yi-fan-wang It looks like you've addressed all the comments that @ahnitz and I had, is that correct? Do you think this is ready to merge? |
@ahnitz @cdcapano All comments addressed. I have launched a few runs and confirm that the commits after Alex's comments has the same results as before. There is a "line too long" complaint from codeclimate (85 characters > 79). I don't know. I kind of think a single line has better readability. If you also think this is minor, then I'll leave as what it is. (Plots to compare runs with commits after Alex's comments and before https://hypatia.aei.mpg.de/~yiwang/ringdown/atlas-result/srate2018-4th-result.png and https://hypatia.aei.mpg.de/~yiwang/ringdown/atlas-result/srate2018-5th-result.png. They look close enough) Also note that (1) this PR changes gate and inpainting everywhere, and it doesn't have backward compatibility, so we should add a notice in GW190521 data release repository and anywhere relevant. (2) after the fork of this branch, there were many new updates for PyCBC inference workflow, for example, take care of #4453. Also, the most recent pegasus, 5.0.6 only works with the most updated (at the time of writing) PyCBC |
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.
Thanks for making the changes, look fine to me.
* apply time shift to account for the gating start time is a subsampling data point. fix a few typos * fix int type error * correct a misunderstanding for apply_fd_time_shift * correct a unused variable * correct the shift time * address cc issues * apply static method * complete the gated_gaussian_noise * typo * typo * re express time shift * space * start to work on pol marg model * complete shifting for marg pol model * instead of modifying models, now implementing time shifting only in gate-and-inpaint session * remove all changes in the model * remove changes in model * fix some bugs when fft/ifft converting, now productive * remove rindex+1 in gate and inpainting, add if condition for time shifting * get rindex_time via actually doing the math, this is faster than retrieve the data sample time array * remove the proj and projslc attributes in gated_gaussian_model, it's used for debugging before
* apply time shift to account for the gating start time is a subsampling data point. fix a few typos * fix int type error * correct a misunderstanding for apply_fd_time_shift * correct a unused variable * correct the shift time * address cc issues * apply static method * complete the gated_gaussian_noise * typo * typo * re express time shift * space * start to work on pol marg model * complete shifting for marg pol model * instead of modifying models, now implementing time shifting only in gate-and-inpaint session * remove all changes in the model * remove changes in model * fix some bugs when fft/ifft converting, now productive * remove rindex+1 in gate and inpainting, add if condition for time shifting * get rindex_time via actually doing the math, this is faster than retrieve the data sample time array * remove the proj and projslc attributes in gated_gaussian_model, it's used for debugging before
* apply time shift to account for the gating start time is a subsampling data point. fix a few typos * fix int type error * correct a misunderstanding for apply_fd_time_shift * correct a unused variable * correct the shift time * address cc issues * apply static method * complete the gated_gaussian_noise * typo * typo * re express time shift * space * start to work on pol marg model * complete shifting for marg pol model * instead of modifying models, now implementing time shifting only in gate-and-inpaint session * remove all changes in the model * remove changes in model * fix some bugs when fft/ifft converting, now productive * remove rindex+1 in gate and inpainting, add if condition for time shifting * get rindex_time via actually doing the math, this is faster than retrieve the data sample time array * remove the proj and projslc attributes in gated_gaussian_model, it's used for debugging before
* apply time shift to account for the gating start time is a subsampling data point. fix a few typos * fix int type error * correct a misunderstanding for apply_fd_time_shift * correct a unused variable * correct the shift time * address cc issues * apply static method * complete the gated_gaussian_noise * typo * typo * re express time shift * space * start to work on pol marg model * complete shifting for marg pol model * instead of modifying models, now implementing time shifting only in gate-and-inpaint session * remove all changes in the model * remove changes in model * fix some bugs when fft/ifft converting, now productive * remove rindex+1 in gate and inpainting, add if condition for time shifting * get rindex_time via actually doing the math, this is faster than retrieve the data sample time array * remove the proj and projslc attributes in gated_gaussian_model, it's used for debugging before
* apply time shift to account for the gating start time is a subsampling data point. fix a few typos * fix int type error * correct a misunderstanding for apply_fd_time_shift * correct a unused variable * correct the shift time * address cc issues * apply static method * complete the gated_gaussian_noise * typo * typo * re express time shift * space * start to work on pol marg model * complete shifting for marg pol model * instead of modifying models, now implementing time shifting only in gate-and-inpaint session * remove all changes in the model * remove changes in model * fix some bugs when fft/ifft converting, now productive * remove rindex+1 in gate and inpainting, add if condition for time shifting * get rindex_time via actually doing the math, this is faster than retrieve the data sample time array * remove the proj and projslc attributes in gated_gaussian_model, it's used for debugging before
* apply time shift to account for the gating start time is a subsampling data point. fix a few typos * fix int type error * correct a misunderstanding for apply_fd_time_shift * correct a unused variable * correct the shift time * address cc issues * apply static method * complete the gated_gaussian_noise * typo * typo * re express time shift * space * start to work on pol marg model * complete shifting for marg pol model * instead of modifying models, now implementing time shifting only in gate-and-inpaint session * remove all changes in the model * remove changes in model * fix some bugs when fft/ifft converting, now productive * remove rindex+1 in gate and inpainting, add if condition for time shifting * get rindex_time via actually doing the math, this is faster than retrieve the data sample time array * remove the proj and projslc attributes in gated_gaussian_model, it's used for debugging before
* apply time shift to account for the gating start time is a subsampling data point. fix a few typos * fix int type error * correct a misunderstanding for apply_fd_time_shift * correct a unused variable * correct the shift time * address cc issues * apply static method * complete the gated_gaussian_noise * typo * typo * re express time shift * space * start to work on pol marg model * complete shifting for marg pol model * instead of modifying models, now implementing time shifting only in gate-and-inpaint session * remove all changes in the model * remove changes in model * fix some bugs when fft/ifft converting, now productive * remove rindex+1 in gate and inpainting, add if condition for time shifting * get rindex_time via actually doing the math, this is faster than retrieve the data sample time array * remove the proj and projslc attributes in gated_gaussian_model, it's used for debugging before
In this PR, I timeshift GW strains such that the gating starting time lands exactly on a specific data sample.