Giter Site home page Giter Site logo

pe3's People

Contributors

jvdoorn avatar

Watchers

 avatar

pe3's Issues

Off-by-one error in averaging loop

The following code contains an off-by-one error:

PE3/analysis/full.py

Lines 44 to 50 in 366d1d2

unique_indices = np.append(unique_indices, -1)
for i, index_pair in enumerate(zip(unique_indices[0:-1], unique_indices[1:])):
start_index, end_index = index_pair
if start_index == end_index or start_index == len(voltage) - 1:
averaged_voltage[i] = voltage[-1]
else:
averaged_voltage[i] = np.mean(voltage[start_index:end_index])

To fix this we should append len(voltage) instead of -1 and remove the if statement in the loop (keeping the body of the else branch).

Use of `np.real` instead of `np.abs`?

There is an ambiguous use of np.real in the following snippets:

PE3/analysis/full.py

Lines 25 to 28 in 366d1d2

filtered_diode_fft = diode_signal.fft
filtered_diode_fft[np.abs(diode_signal.frequencies) >= FILTER_FREQUENCY] = 0
filtered_diode_signal = Signal(diode_signal.sample_rate, np.real(np.fft.ifft(filtered_diode_fft)),
converter=diode_converter)

PE3/analysis/current.py

Lines 19 to 22 in 366d1d2

filtered_diode_fft = diode_signal.fft
filtered_diode_fft[np.abs(diode_signal.frequencies) >= FILTER_FREQUENCY] = 0
filtered_diode_signal = Signal(diode_signal.sample_rate, np.real(np.fft.ifft(filtered_diode_fft)),
converter=diode_converter)

They should probably be replaced with a np.abs call.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.