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

Waveform cleaner #973

Merged
merged 24 commits into from
Feb 27, 2019
Merged

Conversation

FrancaCassol
Copy link
Contributor

Add simple waveform-cleaner to get a baseline subtracted waveform

estimated in a window of "baseline_width" samples, shifted of
"window_shift" samples
"""
baseline_width = Int(10, help='Define then number of samples for estimating the '
Copy link
Contributor

Choose a reason for hiding this comment

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

If window_shift is not equal to zero then it does not represents the baseline_width anymore right ?.
I would suggest to call the two parameters : sample_start sample_end

ctapipe/image/waveform_cleaning.py Outdated Show resolved Hide resolved
@@ -78,7 +78,8 @@ class BaselineWaveformCleaner(WaveformCleaner):

def apply(self, waveforms):
# Subtract baseline
baseline_sub = waveforms - np.mean(waveforms[:, :, self.sample_start:self.sample_end],
baseline_sub = waveforms - \
Copy link
Member

@maxnoe maxnoe Feb 20, 2019

Choose a reason for hiding this comment

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

Please don't use explicit line contiuations with \, use parenthese.

Maybe even split like this:

baseline = np.mean(
    waveforms...,
    axis=2,
)

return waveforms - baseline[:, :, None]

@FrancaCassol
Copy link
Contributor Author

It would be very helpful to me if this very simple PR could be rapidly accepted (it would avoid the copy of the waveform_cleaning.py module in lstchain). Thanks!


def apply(self, waveforms):
# Subtract baseline
baseline = waveforms - np.mean(
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor note, but its not really "baseline" you obtain here, but rather "waveform_corrected" instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Jason, actually it seems to me that the name an the description of this very simple and short function is enough clear.

I have now a question. Who is supposed to accept PRs in ctapipe? For such simple type of PRs (reviewed by at least 3 persons) it would be correct to avoid long delay times.

Copy link
Contributor

@watsonjj watsonjj Feb 21, 2019

Choose a reason for hiding this comment

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

Let me be clearer. The variable you obtain on line 81 is currently called baseline. But it is not baseline, it is the waveform subtracted by the baseline, and is misleading.

Indeed, this PR should be accepted very quickly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, you are right, I misunderstood :-)
Yes, l change it rapidly

watsonjj
watsonjj previously approved these changes Feb 21, 2019
@FrancaCassol
Copy link
Contributor Author

Please, could this PR be taken into account?

maxnoe
maxnoe previously approved these changes Feb 26, 2019
@watsonjj watsonjj dismissed stale reviews from maxnoe and themself via ad0cead February 27, 2019 09:32
@codecov
Copy link

codecov bot commented Feb 27, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@a413cd3). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #973   +/-   ##
=========================================
  Coverage          ?   78.19%           
=========================================
  Files             ?      194           
  Lines             ?    11313           
  Branches          ?        0           
=========================================
  Hits              ?     8846           
  Misses            ?     2467           
  Partials          ?        0
Impacted Files Coverage Δ
ctapipe/image/waveform_cleaning.py 98.36% <100%> (ø)
ctapipe/image/tests/test_waveform_cleaning.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a413cd3...d585206. Read the comment docs.

@watsonjj watsonjj merged commit dcb64d4 into cta-observatory:master Feb 27, 2019
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.

5 participants