Skip to content

Comments #1

@vector91

Description

@vector91

General comments/tips

  • comment your code! If you'll write the report in February you will be very grateful to your past self for having added comments. And good comments are "why did we do this" rather than just saying "we did this"
  • When making plots, it's useful to add a grid plt.grid(alpha=0.3) to help with readability
  • If you want to use the standard matplotlib colors, they are called 'C0', 'C1', ...
  • There is much of the code that is duplicated several times (e.g. decode_scope_data.py). This can be avoided by having a better folder structure.
  • Some of the comments below apply to more files, I don't repeat them every time

PMT_DataAnalysis.ipynb

  • second cell, you can use np.loadtxt, have a look at it here
  • don't use min as a variable name, what happens if later you call min(...) ?
  • cell 3, you don't really need np.where. You can just do index_dis = min < discriminator_value, this gives an array of booleans that can be use to index an array, so later when you have min_dis = min[index_dis] it still works. Additionally, len(index_dis) can become np.sum(index_dis).
  • try not to use len() with numpy arrays, I would recommend a.shape

PMT_DataExtraction.ipynb

  • cell 3, when you get the minimum: that's quite convoluted, I think you just need to use np.argmin
  • to get the baseline (what you call "ground", not the best name) usually you use a fixed number of samples, to be consistent between waveforms (anyway the trigger should always be at a fixed sample)
  • when you integrate a waveform, usually you do it in a window where the signal is, not on the whole waveform to get a better signal to noise ratio
  • please use f-strings: f.write(f'{m},{integral}\n') and not str(m).... f-strings have the added bonus of allowing to format numbers (e.g. f'{m:.3f}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions