Created
November 1, 2017 12:40
-
-
Save llondon6/879023065bd1ab6f0e3b20a684b89ef9 to your computer and use it in GitHub Desktop.
Quick example for using maketaper in positive.maths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The maketaper functoin takes in a time series (any function domain really), and a 2x1 iterable of indeces defining the start and end of the taper. | |
# For example: | |
# Make fake data | |
mock_times = arange(1,10) | |
mock_range_values = ones_like( dummy_times ) | |
index_start = 1 | |
index_end = 4 | |
# Create a taper function | |
the_taper = maketaper( mock_times, [index_start,index_end] ) | |
# Plot the taper function against the dummy data | |
plot( mock_times, mock_range_values, '-o', label='mock data' ) | |
plot( mock_times, the_taper, '-rs', label='taper function' ) | |
xlim([0,10]) | |
ylim([-0.25,1.25]) | |
xlabel('mock times') | |
ylabel('mock data') | |
legend(frameon=False,loc='best') | |
# To apply the taper, simply multiply the data by the taper | |
tapered_mock_values = the_taper * mock_range_values | |
# Plot the result | |
figure() | |
plot( mock_times, tapered_mock_values, '-og' ) | |
ylim([-0.25,1.25]) | |
xlabel('mock times') | |
ylabel('tapered mock data') | |
legend(frameon=False,loc='best') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment