Skip to content

Comments

WIDEFIELD: Add TraceMetrics integration to WidefieldAnalysis for trace analysis#93

Open
iezqrom wants to merge 2 commits intowidefield-devfrom
trace-metrics
Open

WIDEFIELD: Add TraceMetrics integration to WidefieldAnalysis for trace analysis#93
iezqrom wants to merge 2 commits intowidefield-devfrom
trace-metrics

Conversation

@iezqrom
Copy link
Collaborator

@iezqrom iezqrom commented Dec 18, 2025

  • Updated init.pyi to include TraceMetrics in exports.
  • Implemented get_trace_metrics method in WidefieldAnalysis for analyzing 1D traces with detailed documentation and error handling.

iezqrom and others added 2 commits December 18, 2025 10:37
- Updated __init__.pyi to include TraceMetrics in exports.
- Implemented get_trace_metrics method in WidefieldAnalysis for analyzing 1D traces with detailed documentation and error handling.
@iezqrom iezqrom requested a review from zeniazen5 December 18, 2025 09:38
if len(trace_segment) < 3:
return None, None

first_deriv = np.diff(trace_segment)

Choose a reason for hiding this comment

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

I have a question here is np.diff better than np.derivative for the detection of the first derivative or is it the same ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can't find np.derivative as a function in numpy? did you mean something else

Choose a reason for hiding this comment

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

yes you are right np.gradient

Choose a reason for hiding this comment

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

okay i looked for this and turns out the np.diff calculates the differences between each point and it produces always shorter array by one value where np.gradient calclulates the slop and it is always the same lenght array as the input so i guess depends where you use it

Choose a reason for hiding this comment

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

so maybe np.diff makes sense to see the latency to the peak for example but np.gradient to see how fast the response reaches the peak ? maybe i am thinking this too much

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you are right to question diff vs gradient, but i think they can both be used for the same things and it seems like np.gradient is slightly better for a few reasons like what you mention and it is less noise-sensitive

i'll change it

@iezqrom iezqrom changed the title Add TraceMetrics integration to WidefieldAnalysis for trace analysis WIDEFIELD: Add TraceMetrics integration to WidefieldAnalysis for trace analysis Jan 28, 2026
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