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

Documentation / poetry improvements and fixes #773

Merged
merged 18 commits into from
Jan 22, 2025

Conversation

sjoerd-bouma
Copy link
Collaborator

I suppose technically this could have been two PRs but no functionality should be affected.

  1. Optional dependencies weren't really implemented correctly in pyproject.toml (I accept full responsibility). This made very little difference, but the advantage is they can now be installed also using the conventional pip syntax pip install nuradiomc[documentation, proposal] to install the correct optional dependencies. Previously, optional dependencies were implemented as developer dependencies, and would never be installed during pip installation.
  2. The rest is minor fixes to the documentation: some missing docstrings from the recent refactoring, and an attempt to somewhat tidy up the new 'overview of times' page, though I find the content somewhat unclear still. The table of contents on code documentation pages now also only shows top-level submodule and subpackage names instead of every method of every class inside them, which I think improves clarity,

@sjoerd-bouma
Copy link
Collaborator Author

ping @fschlueter - I hope you're happy with the changes. I think I have correctly described the way trigger times work as well in times.rst as well as the trigger docstrings. If/once we deprecate the triggerTimeAdjuster (#763) its section can be removed.

@fschlueter
Copy link
Collaborator

A general comment/question. You are often always omitting the "." at the end of a sentence. I assume this is on purpose? Is there a PEP rule/suggestion on this? Similarly, you do not start sentences with a capitalised letter. Both of that I would do but I do not care much if we just try to be consistent with that in the future (or decide intentionally to be not consistent with that)?

Comment on lines 11 to 14
To avoid this behavior we often use the following procedure, through the `NuRadioReco.modules.channelStopFilter` module:

We smoothly filter the first 5% and last 5% of the trace using a Tukey window function. This is a function that goes smoothly from 0 to 1.
To avoid rollover of the pulse, we add 128ns of zeros to the beginning and end of the trace. Steps 2) and 3) are performed by the channelStopFilter module
Both electric fields and channels have a trace_start_time variable. The get_times() function will automatically add the trace_start_time to the time array.
To avoid rollover of the pulse, we add 128ns of zeros to the beginning and end of the trace.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is that really true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://nu-radio.github.io/NuRadioMC/NuRadioReco/apidoc/NuRadioReco.modules.channelStopFilter.html#module-NuRadioReco.modules.channelStopFilter

It is what the channelstopfilter does. Whether it is actually used in practice or not is up to the user, I think : )

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, but how it is written within the docu suggests that it is the common/default behaviour. Maybe we can add this module to the list of modules which change the timing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is/was already there. As an aside, it doesn't do what it says here (the trace start time is not adjusted), but I will make a separate bugfix for that.

@sjoerd-bouma
Copy link
Collaborator Author

A general comment/question. You are often always omitting the "." at the end of a sentence. I assume this is on purpose? Is there a PEP rule/suggestion on this? Similarly, you do not start sentences with a capitalised letter. Both of that I would do but I do not care much if we just try to be consistent with that in the future (or decide intentionally to be not consistent with that)?

I agree. Though I would like to point out that times.rst was not written by me and I'm just trying to clean it up a bit. I also don't think it's worth getting too upset over typos, missing capitals or full stops in doc strings (and I don't think it's necessary to enforce some kind of standard), though obviously correctly written and formatted text is nicer to read.

@fschlueter
Copy link
Collaborator

A general comment/question. You are often always omitting the "." at the end of a sentence. I assume this is on purpose? Is there a PEP rule/suggestion on this? Similarly, you do not start sentences with a capitalised letter. Both of that I would do but I do not care much if we just try to be consistent with that in the future (or decide intentionally to be not consistent with that)?

I agree. Though I would like to point out that times.rst was not written by me and I'm just trying to clean it up a bit. I also don't think it's worth getting too upset over typos, missing capitals or full stops in doc strings (and I don't think it's necessary to enforce some kind of standard), though obviously correctly written and formatted text is nicer to read.

I was not referring to `times.rst' but the doc-strings in function definitions.


[tool.poetry.extras]
documentation = ["Sphinx", "sphinx-rtd-theme", "numpydoc"]
proposal = ["proposal"]
galacticnoise = ['pygdsm']
ift_reco = ['nifty5', 'pypocketfft']
muon_flux_calc = ['MCEq', 'crflux']
RNO_G_DATA = ["mattak", "runtable", "pandas"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why removing runtable and pandas from the RNO_G_DATA dependencies?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mean, frankly, I don't remember. But runtable is not a public dependency so will fail (and the installation will error out) for some users (probably mainly RNO-G users that don't have their git profile set up via ssh), whereas reading RNO-G data is in theory possible for everyone with mattak only.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've added a separate rno-g-extras option now with the runtable, that does not get installed by default. Not sure if there is a better solution; in any case once you try to use the RNO-G reader it suggests installing the run table, I think.

@sjoerd-bouma
Copy link
Collaborator Author

@fschlueter let me know if you're happy with it now. I also fixed the missing tables in the current documentation - not sure why or when the previous way of writing table headers was deprecated (couldn't find it in the Sphinx changelog) but I just changed it to how https://sublime-and-sphinx-guide.readthedocs.io/en/latest/tables.html suggests to write tables (well, more or less...)

Times in `Channel <NuRadioReco.framework.channel.Channel>`, `ElectricField <NuRadioReco.framework.electric_field.ElectricField>` and
`Trigger <NuRadioReco.framework.trigger.Trigger>` objects are all defined relative to the
`station_time <NuRadioReco.framework.station.Station.get_station_time>` of the Station they are stored in (see the description
of the :doc:`NuRadio data structure </NuRadioReco/pages/event_structure>`). These times are stored as an array of floats.
Copy link
Collaborator

Choose a reason for hiding this comment

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

These times are stored as an array of floats.

To what does this refer?

Comment on lines 27 to 29
The global time at which the event takes place is stored as the `event time <NuRadioReco.framework.event.Event.get_event_time>`
in the `Event <NuRadioReco.framework.event.Event>` object.
This time usually corrsponds to the "vertex time" of the first interaction for simulations,
Copy link
Collaborator

Choose a reason for hiding this comment

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

For data the event and station time are typically the same, right? The only exception I can think of is that we - as part of an event reconstruction - merge events across stations. Can we add a statement here - just to be very explicit.

@fschlueter
Copy link
Collaborator

@sjoerd-bouma great work, thank you so much! I have a few more minor comments (I think we should make the documentation explicit AF to never touch it again (or at least not for a very long time).

Comment on lines +738 to +739
"""
returns the current primary measurement of the component, reads in the component collection
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor comment, I think with the PR #788 I am adding a wrapper around this function within the detector class which probably should be used by users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Then maybe you can update this docstring / the module docstring in #788? Feel free to copy and paste stuff from here if you think it applies.

Comment on lines +136 to +137
For some triggers, in addition to the time of the first trigger,
also all subsequent times where the trigger condition were fulfilled are
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we not duplicate a remark there that the trigger time is relative to the station_time?


* hardwareResponseIncorporator (sim to data):
* the channel traces are folded with the amplifier response which also includes some time delay
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would add a statement that this time delay is reflected by moving the pulse within the trace and not by adjusting the trace_start_time

@sjoerd-bouma
Copy link
Collaborator Author

@fschlueter hopefully I've addressed your remaining comments. I also reformatted a couple of docstrings that were causing warnings during compilation.

@sjoerd-bouma sjoerd-bouma merged commit 2cfc1a2 into develop Jan 22, 2025
5 checks passed
@sjoerd-bouma sjoerd-bouma deleted the poetry/improve-optional-deps branch January 22, 2025 15:06
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