Skip to content

Conversation

@santosj7
Copy link

added plot script for waveform and changed the make to add more arguments.

@@ -0,0 +1,28 @@
import make_waveforms
import pylab as pl
import numpy as np
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put numpy and pylab imports above make_waveforms

import make_waveforms
import pylab as pl
import numpy as np

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add docstrings for all new functions.

import numpy as np


hp,hc= make_waveforms.make_tidal_waveform(mass1= 10, mass2 = 8, s1z=0, approx = "SpinTaylorT4")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are hardcoding the values of hp and hc. Instead, you should write a function that will take in the values of the set of parameters that are required to make the waveforms. that way every time you want to run the code with different parameters you will not have to change the code. Changing the code will mean you will have to again add, commit and push in git, again create pull request, and again this process.

Comment on lines +12 to +17
def get_times(hp):
t=[]
for t in range (0,10):
t=np.arange(0, -hp.epoch.gpsSeconds - hp.epoch.gpsNanoSeconds*1e-9 + hp.deltaT, hp.deltaT)
t=t[:hp.data.length]
return t
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have initialized a list t, but then you wrote for t in range (0,10):, which will overwrite the empty list t by the iterating integer. Then inside the loop you are creating a numpy array t which is the actual array of time. Finally, you are cropping the array up to the length of the waveform. So the first two t are actually never used. Your for loop is doing nothing, except the same computation t=np.arange(0, -hp.epoch.gpsSeconds - hp.epoch.gpsNanoSeconds*1e-9 + hp.deltaT, hp.deltaT) is repeated 10 times. This whole thing can be replaced by this:

def get_times(hp):
    t = np.arange(0, -hp.epoch.gpsSeconds - hp.epoch.gpsNanoSeconds*1e-9 + hp.deltaT, hp.deltaT)
    return t[:hp.data.length]

Comment on lines +18 to +28
pl.plot(get_times(hp), hp.data.data, label= "Without Spin")

#t=np.arange(0, -hp.epoch.gpsSeconds -hp.epoch.gpsNanoSeconds*1e-9 +hp.deltaT, hp.deltaT)
#t=t[:hp.data.length]
#return t
pl.plot(get_times(hp2), hp2.data.data, label= "With Spin")
pl.plot(get_times(hp3), hp3.data.data, label= "With Negative Spin")
pl.xlabel("Time (s)")
pl.ylabel("Strain")
pl.legend()
pl.savefig("MultiPlot1.png")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plotting script needs to be generalized so that it can work with any number of waves. Right now if I ask you add another wave, you will have to add that line in the code.

@shaonghosh shaonghosh changed the title WIP: added plot script for multi waveforms [WIP] added plot script for multi waveforms Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants