The Second CTA Pipeline Developer’s...

23
Introduction Tailcut Wavelets Conclusion References The Second CTA Pipeline Developer’s Workshop Advanced Image Cleaning er´ emie Decock CEA Saclay - Irfu/SAp October 11, 2016 Decock CEA Saclay - Irfu/SAp The Second CTA Pipeline Developer’s Workshop

Transcript of The Second CTA Pipeline Developer’s...

  • Introduction Tailcut Wavelets Conclusion References

    The Second CTA Pipeline Developer’s WorkshopAdvanced Image Cleaning

    Jérémie Decock

    CEA Saclay - Irfu/SAp

    October 11, 2016

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Introduction

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Introduction

    Subject

    Try to improve image cleaning before Hilas parametrization

    Improve methods to remove:

    I Instrumental noise

    I Background noise

    Motivations:

    I Keep more signal (deeper into the noise)

    I Reduce threshold

    I Maybe eventually do cleaning and time-integration all at once

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Current method (HESS)

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Description

    The “Tailcuts clean” algorithmA very simple cleaning procedure:

    I Keep pixels above a given threshold (e.g. 10 PE)

    I Keep some neighbors of these selected pixels: those above asecond (lower) threshold (e.g. 5 PE)

    0 5 10 15 20 25 30 350

    5

    10

    15

    20

    25

    30

    35

    Original image

    0

    4

    8

    12

    16

    20

    24

    28

    0 5 10 15 20 25 30 350

    5

    10

    15

    20

    25

    30

    35

    First threshold

    0

    4

    8

    12

    16

    20

    24

    28

    0 5 10 15 20 25 30 350

    5

    10

    15

    20

    25

    30

    35

    Second threshold

    0

    4

    8

    12

    16

    20

    24

    28

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Description

    Example

    0 5 10 15 20 25 30 350

    5

    10

    15

    20

    25

    30

    35

    Input image

    0 5 10 15 20 25 30 350

    5

    10

    15

    20

    25

    30

    35

    Reference image

    0 5 10 15 20 25 30 350

    5

    10

    15

    20

    25

    30

    35

    Cleaned image

    0

    4

    8

    12

    16

    20

    24

    28

    0

    3

    6

    9

    12

    15

    18

    21

    24

    27

    30

    0

    3

    6

    9

    12

    15

    18

    21

    24

    27

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Description

    Remarks

    I Fast and simple

    I Sufficient for bright showers

    I But surely we can do better for faint showers

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    An alternative method

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Description

    Basic idea

    I Tailcut method: threshold in the main space

    I Better idea: threshold in a different space where signal andnoise can be easily separated

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Description

    Wavelet Transform method

    Roughly the same idea than doing filtering with Fourier Transform

    I Apply the transform on the signal

    I Apply a threshold in the transformed space

    I Invert the transform to go back to the original signal space

    Differences with Fourier Transform

    I Use wavelets instead sin and cos functions as new bases in thetransformed space

    I The transformed space contains spatial information

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Description

    Overview

    A wavelet looks like this (Morlet):

    “A wave-like oscillation with an amplitude that begins at zero,increases, and then decreases back to zero”

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Conclusion

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    Conclusion

    Conclusion

    This is a work is in progress... We will try to give some first resultsin Bologna Meeting or soon after

    Thanks to CosmoStat we have some tools to apply wavelettransforms (”mr transform”)

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Introduction Tailcut Wavelets Conclusion References

    References I

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    Appendix

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    Noise

    ClarificationsDifferent kind of “noise” in telescope images (to be completed...)

    1. Instrumental noise (Photomultiplier Tubes, ...)I Thermionic emissionI RadiationsI Electric noise

    2. Background noise (Night Sky Background or NSB)I Parasite light (moon, stars, planes, light pollution, ...)

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    Tailcut

    The “Tailcuts clean” listing (Python)

    1 def tailcuts_clean(geom , image , pedvars ,

    picture_thresh =4.25, boundary_thresh =2.25):

    2

    3 clean_mask = image >= picture_thresh * pedvars

    4 boundary_mask = image >= boundary_thresh * pedvars

    5

    6 boundary_ids = []

    7 for pix_id in geom.pix_id[boundary_mask ]:

    8 if clean_mask[geom.neighbors[pix_id ]]. any():

    9 boundary_ids.append(pix_id)

    10

    11 clean_mask[boundary_ids] = True

    12

    13 return clean_mask

    listings/tailcuts clean.py

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    FFT

    First alternativeDiscrete Fourier Transform method

    I Previous filter: threshold in the main space

    I Better idea: threshold in a different space where signal andnoise can be easily separated

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    FFT

    Fourier transform

    f (t) =a02

    +∞∑n=1

    (an cos(nt) + bn sin(nt))

    an =1

    π

    ∫ π−π

    f (t) cos(nt)dt

    bn =1

    π

    ∫ π−π

    f (t) sin(nt)dt

    Discrete Fourier Transform (DFT)

    Fourier Transform for discrete signals (digital pictures, ...)

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    FFT

    Clean signals with DFTRemove noise in direct space: difficult (here)

    10 5 0 5 104

    3

    2

    1

    0

    1

    2

    3

    4Noised signal

    10 5 0 5 104

    3

    2

    1

    0

    1

    2

    3

    4Signal

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    FFT

    Clean signals with DFTRemove noise in transformed space: easy (here)

    I Apply DFT

    I Apply a threshold

    I Apply invert DFT

    10 5 0 5 104

    3

    2

    1

    0

    1

    2

    3

    4Noised signal

    0 20 40 60 80 100 120

    -100

    0

    100

    101

    102

    Fourier coefficients

    10 5 0 5 104

    3

    2

    1

    0

    1

    2

    3

    4Filtered signal

    0 20 40 60 80 100 120

    -100

    0

    100

    101

    102

    Filtred fourier coefficients

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    FFT

    Remarks

    FFT can be applied to any T -periodic function f verifying theDirichlet conditions:

    I f must be continuous

    I and monotonic

    I on a finite number of sub-intervals (of T )

    Signals defined on bounded intervals (e.g. images) can beconsidered as periodic functions (applying infinite repetitions)

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

  • Appendix

    FFT

    Analyse

    Works well:

    I when the Fourier coefficients for the signal and the noise caneasily be separated in the Fourier space (obviously...)

    I e.g. when either the signal or the noise can be defined withfew big Fourier coefficients (i.e. signal or noise have a fewnumber of significant harmonics)

    Decock CEA Saclay - Irfu/SAp

    The Second CTA Pipeline Developer’s Workshop

    IntroductionIntroduction

    Current method (HESS)Description

    An alternative methodDescription

    ConclusionConclusion

    AppendixNoiseTailcutFFT