Question

Write a function to find the indices of a time series in which the absolute value...

Write a function to find the indices of a time series in which the absolute value of the derivative is above a particular threshold. This is somewhat based on work we’ve done in this chapter. The function:
(a) should be named where_deriv_large.
(b) should take two arguments: times, data (in that order).
(c) (509 only) should have a third argument in which the value of the threshold can be passed.

(d) should return a tuple. The first element is the indices of the derivative that exceed a particular threshold. The second element is the count of the number of values of the derivative exceed the threshold The third element is the (signed) derivative values for the entire time series.

Let’s set the threshold to nominally be 5000. So, your function will find where (wink) the absolute value of the derivative of a time series is larger than 5000.
Test your function using the data we’ve used in this chapter: where p_vars

Write your function in a module named time_series.py.

idx, cnt, deriv = where_deriv_large(p_vars['times'], p_vars['data'])

Homework Answers

Answer #1

#import the required libraries

def where_deriv_large(t,d): #declare and define the function with times and data as arguments

def f(x):

return abs(x) # return absolute value

dx = f(x).diff(x) # derivative dx

dx

(re(x)*Derivative(re(x), x) + im(x)*Derivative(im(x), x))/Abs(x) # perform derivative calculation

thr=0 # assign the threshold value

tuple=() # declare function for tuple

if thr>5000: # test condition if threshold is greater than 5000

tuple[0]= # consider the indices of element which satistfies the test condition

tuple[1]= # consider the count values that satisfy above condition

tuple[2]= # consider derivative values of entire time series (dx)

return tuple() # return tuple with the above three values

Note: The above pseudocode is written in Python Programming language.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1. Write a function to find the indices of a time series in which the absolute...
1. Write a function to find the indices of a time series in which the absolute value of the derivative is above a particular threshold. This is somewhat based on work we’ve done in this chapter. The function: (a) should be named where_deriv_large. (b) should take two arguments: times, data (in that order). (d) should return a tuple. The first element is the indices of the derivative that exceed a particular threshold. The second element is the count of the...
Write a C++ program that converts time of day from a 24-hour notation to a 12-hour...
Write a C++ program that converts time of day from a 24-hour notation to a 12-hour notation. For example, it should convert 14:25 to 2:25 PM. (A) The user provides input as two integers separated by ‘:’. The following function prototype should capture the user inputs as described below: void input(int& hours24, int& minutes); //Precondition: input(hours, minutes) is called with //arguments capable of being assigned values. //Postcondition: // user is prompted for time in 24 hour format: // HH:MM, where...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...