Skip to content

Commit

Permalink
Added flake8 and linted our current code (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
egriendeau authored Nov 30, 2023
2 parents a31cdb7 + a485dd0 commit 3f5034f
Show file tree
Hide file tree
Showing 28 changed files with 695 additions and 725 deletions.
42 changes: 42 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- mode: conf; -*-
## flake8 default linting configuration
#
# Loaded by flake8 by default

[flake8]
# DO NOT check for the following errors:
#F403 unable to detect undefined names

# E265: block comment should start with '# '
# (Note: autopep8 will not fix instances of commented-out code)
# E266: too many leading '#' for block comment
# E402: module level import not at top of file
# E701: multiple statements on one line (colon)
# E702: multiple statements on one line (semicolon)
# E704: multiple statements on one line (def)
# E722: do not use bare except, specify exception instead
# E741: do not use variables named 'l', 'O', or 'I'
# W503: line break before binary operator
# W605: invalid escape sequence 'x'
# (Note: would only raise on false-positives in LaTeX samples)
# F401: module imported but unused
# F403: 'from module import *' used; unable to detect undefined names
# F405: name may be undefined, or defined from star imports: module
# N806: variable in function should be lowercase
ignore=F403,E266,W503,W291,W293

exclude=
qick/*.py

# N801 : class name should not be mixed case
# N802 : function name should be lowercase
# N805 : first argument to method should be called 'self'
per-file-ignores =
qickdawg/__init__.py:F401
qickdawg/nvpulsing/__init__.py:F401
qickdawg/fitfunctions/__init__.py:F401
qickdawg/util/__init__.py:F401

# 120 characters is a more agreeable max line length for modern displays
max-line-length=120

54 changes: 0 additions & 54 deletions change.log

This file was deleted.

4 changes: 2 additions & 2 deletions qickdawg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qickdawg.util import *
from .nvpulsing import *
from .fit_functions import *
from qickdawg.nvpulsing import *
from qickdawg.fitfunctions import *

# Now using QICK 0.2.160 as of 7/03/2023
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np


def exponential_decay(x, a, t, y0):

return a*np.exp(-x/t) + y0
return a * np.exp(-x / t) + y0
16 changes: 8 additions & 8 deletions qickdawg/nvpulsing/getreadoutwindow.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''
get_readout_window
=======================================================================
An function that acquires a timedomain readout window signal that
An function that acquires a timedomain readout window signal that
is composed of multiple segments due to the limited memory assigned to the
FPGA buffer. Furhtermore, this take a readout window with and without a microwave
pulse to generate a spin contrast that can be used to calibrate the averaging time
Expand All @@ -12,11 +12,12 @@

import numpy as np


def get_readout_window(config, n_time_bins):
'''
Function that acquires two readoutwindows by combining
Function that acquires two readoutwindows by combining
n_time_bins number of window
Parameters
----------
soc : ::class:`~qick.QickSoc`
Expand All @@ -29,14 +30,14 @@ def get_readout_window(config, n_time_bins):
Returns
--------
(np.array, np.array, qickdawg.NVAveragerProgram) a three tuple
consisting of
(np.array, np.array, qickdawg.NVAveragerProgram) a three tuple
consisting of
1D np.array of the readout window with microwave on
1D np.array of the readout window wiht microwave off
The average program instance for diagnostics
'''
pi2 = config.mw_pi2_tus
laser_readout_offset_treg = config.laser_readout_offset_treg
laser_readout_offset_treg = config.laser_readout_offset_treg
config.mw_pi2_tus = 0

for i in range(n_time_bins):
Expand All @@ -57,7 +58,7 @@ def get_readout_window(config, n_time_bins):
config.mw_pi2_tus = pi2

for i in range(n_time_bins):
prog=ReadoutWindow(config)
prog = ReadoutWindow(config)
if i == 0:
laser_readout_offset_treg = config.laser_readout_offset_treg
prog = ReadoutWindow(config)
Expand All @@ -71,4 +72,3 @@ def get_readout_window(config, n_time_bins):
print(i, config.laser_readout_offset_treg)

return data_on, data_off, prog

Loading

0 comments on commit 3f5034f

Please sign in to comment.