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 function that accepts an int array and the array’s size as arguments. The function...
Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer to the new array. Demonstrate the function by using it in a main program that reads an integer N (that is not more than 50) from standard input and then reads N integers from a file named data into an...
Develop a python program to find the different solutions, i.e. zero crossings, of a polynomial function...
Develop a python program to find the different solutions, i.e. zero crossings, of a polynomial function using Newton-Raphson’s method over a given range. To do this we will develop three functions: the first should be a function to evaluate the polynomial at a given value of the independent variable; the second function would evaluate the derivative of the polynomial at a given value of the independent variable; finally, the third function would implement Newton-Raphson’s (NR) method to determine a zero...
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...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory – shmget,...
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT