localCTV.py 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import numpy as np
  2. # #expected signature is like this:
  3. # def ctv_dummy(
  4. # time_trace, sampling_period,
  5. # first_frame, last_frame,
  6. # stimulus_number, stim_on_times, stim_off_times,
  7. # flags, p1):
  8. # """
  9. # dummy CTV to specify function call signature
  10. # :param time_trace: iterable of numbers
  11. # :param sampling_period: float, sampling period of <time_trace>, in ms
  12. # :param first_frame: int, interpreted as a frame number, where frames are numbered 0, 1, 2...
  13. # :param last_frame: int, interpreted as a frame number, where frames are numbered 0, 1, 2...
  14. # :param stimulus_number: int, indicates the which stimulus to use, use 1 for first stimulus
  15. # :param stim_on_times: list of floats, stimulus onset times, in ms
  16. # :param stim_off_times: list of floats, stimulus offset times, in ms
  17. # :param flags: FlagsManager object, is a mapping of flag names to flags values with additional functions
  18. # :param p1: pandas.Series object, internal representation of data
  19. # :rtype: list
  20. # :return: one member, float
  21. # """
  22. # return [0]
  23. def ctvBente(time_trace, sampling_period,
  24. first_frame, last_frame,
  25. stimulus_number, stim_on_times, stim_off_times,
  26. flags, p1):
  27. """
  28. ana's method -222
  29. mean(13-16) - mean(6-9) 4 frames each
  30. <insert a brief description of the method here>
  31. :param time_trace: iterable of numbers
  32. :param first_frame: int, interpreted as a frame number, where frames are numbered 1, 2, 3...
  33. :param last_frame: int, interpreted as a frame number, where frames are numbered 1, 2, 3...
  34. :param sampling_period: float, sampling period of <time_trace>, in ms
  35. :param stim_on_times: list of floats, stimulus onset times, in ms
  36. :param stim_off_times: list of floats, stimulus offset times, in ms
  37. :param flags: FlagsManager object, is a mapping of flag names to flags values with additional functions
  38. :param p1: pandas.Series object, internal representation of data
  39. :return: float
  40. """
  41. # print('**************************** running ctvBente now: ')
  42. # print('len time trace is: ', str(len(time_trace)))
  43. output = np.mean(time_trace[30:40]) - np.mean(time_trace[10:20])
  44. return [output]
  45. def myownctv22(time_trace, sampling_period,
  46. first_frame, last_frame,
  47. stimulus_number, stim_on_times, stim_off_times,
  48. flags, p1):
  49. """
  50. ana's method -222
  51. mean(13-16) - mean(6-9) 4 frames each
  52. <insert a brief description of the method here>
  53. :param time_trace: iterable of numbers
  54. :param first_frame: int, interpreted as a frame number, where frames are numbered 1, 2, 3...
  55. :param last_frame: int, interpreted as a frame number, where frames are numbered 1, 2, 3...
  56. :param sampling_period: float, sampling period of <time_trace>, in ms
  57. :param stim_on_times: list of floats, stimulus onset times, in ms
  58. :param stim_off_times: list of floats, stimulus offset times, in ms
  59. :param flags: FlagsManager object, is a mapping of flag names to flags values with additional functions
  60. :param p1: pandas.Series object, internal representation of data
  61. :return: float
  62. """
  63. output = np.mean(time_trace[30:40]) - np.mean(time_trace[5:95])
  64. return [output]