Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for selecting a TOA range in detector plots #304

Merged
merged 4 commits into from
Feb 12, 2025

Conversation

SimonHeybrock
Copy link
Member

@SimonHeybrock SimonHeybrock commented Feb 3, 2025

Fixes #305.

@jokasimr jokasimr self-assigned this Feb 5, 2025
if (toa_range := self._toa_range()) is None:
return data
low, high = toa_range
return data.bins.assign_coords(toa=data.bins.data).bins['toa', low:high]
Copy link
Contributor

Choose a reason for hiding this comment

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

I need some explanation here 😄

  • What is data? (What shape shape and what fields is it expected to have?)
  • Why do we need to assign coords?
  • Why is toa=data.bins.data?

options=[
{'label': 'Filter by time-of-arrival [μs]', 'value': 'enabled'}
],
value=[],
Copy link
Contributor

Choose a reason for hiding this comment

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

(minor) checklist is slightly odd for what seems to be a "toggle" on/off, maybe consider https://dash.plotly.com/dash-daq/booleanswitch

Copy link
Member Author

Choose a reason for hiding this comment

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

That appears to be from a different library (dash_daq)?

Comment on lines +149 to +150
sc.scalar(value['low'], unit=value['unit']).to(unit='ns'),
sc.scalar(value['high'], unit=value['unit']).to(unit='ns'),
Copy link
Member

Choose a reason for hiding this comment

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

Will the unit always be 'ns', or should we instead just store floats and use the units of data.bins.coords['toa'] in apply_toa_range below?

Copy link
Member Author

Choose a reason for hiding this comment

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

The bounds come via a message from Kafka. It is essential to send to unit with this (or you will waste hours debugging). Not sure what is the benefit from your suggestion, recreating the low and high variables in every single call below? It is just making it a bit slower?

dcc.Checklist(
id='toa-checkbox',
options=[
{'label': 'Filter by time-of-arrival [μs]', 'value': 'enabled'}
Copy link
Member

Choose a reason for hiding this comment

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

It seems it's microseconds here and nanoseconds above?

Copy link
Member Author

Choose a reason for hiding this comment

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

Where?

Copy link
Member

Choose a reason for hiding this comment

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

The text in the html.Label is 'Time-of-arrival range (us)', and the unit label in the square brackets is Filter by time-of-arrival [μs]?

Unless this is not the same time as in the _convert_toa_range function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure I understand, us is just another spelling of microsecond?

Copy link
Member

@nvaytet nvaytet Feb 7, 2025

Choose a reason for hiding this comment

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

What I meant was that on L149-150 in detector_data_handler.py you seem to have converted them to nanoseconds?
By 'above' I meant further up the page, not in the same file, sorry.

Copy link
Member Author

Choose a reason for hiding this comment

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

What is wrong with converting microseconds to nanoseconds? The dashboard uses microseconds, since nanoseconds are a bit unwieldy for a user to think about.

Base automatically changed from roi-histogram to main February 12, 2025 04:03
@SimonHeybrock SimonHeybrock merged commit b87c4ff into main Feb 12, 2025
4 checks passed
@SimonHeybrock SimonHeybrock deleted the toa-range branch February 12, 2025 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants