Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 23, 2023
1 parent a317635 commit af036f3
Show file tree
Hide file tree
Showing 27 changed files with 8,498 additions and 8,519 deletions.
2 changes: 0 additions & 2 deletions bin/exportProcessedData.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@


for evFileName in evFileNames:

# open the EV file
evFile = evApp.OpenFile(os.path.join(evDir, evFileName))
print(" opened {}".format(evFileName))
Expand All @@ -296,7 +295,6 @@
evFile.Save()

for binSize in binSizes:

# Use this as the reference line for depth grid
refline = evFile.Lines.FindByName(linename)
av.Properties.Grid.DepthRangeReferenceLine = refline
Expand Down
1 change: 0 additions & 1 deletion echofilter/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ def num_samples(self):
return len(self.data_source)

def __iter__(self):

n_sample = len(self.data_source)
n_dataset = len(self.data_source.cumulative_sizes)

Expand Down
8 changes: 0 additions & 8 deletions echofilter/data/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def __init__(self, output_size, order=1):
self.order = order

def __call__(self, sample):

order = self.order
if order is None:
order = np.random.randint(1)
Expand Down Expand Up @@ -224,7 +223,6 @@ def __init__(self, *args, p=0.5, **kwargs):
self.p = p

def __call__(self, sample):

if random.random() > self.p:
# Nothing to do
return sample
Expand Down Expand Up @@ -341,7 +339,6 @@ def __init__(self, output_size, p=0.5, sigma=8.0, alpha=0.05, order=1):
self.alpha = _pair(alpha)

def __call__(self, sample):

if random.random() > self.p:
# Nothing to do
return sample
Expand Down Expand Up @@ -464,7 +461,6 @@ def __init__(self, center, deviation, robust2stdev=True):
self.robust2stdev = robust2stdev

def __call__(self, sample):

if not isinstance(self.center, str):
center = self.center
elif self.center.lower() == "mean":
Expand Down Expand Up @@ -521,7 +517,6 @@ def __init__(self, nan_val=0.0):
self.nan_val = nan_val

def __call__(self, sample):

# Can't use np.nan_to_num to assign nan to a specific value if
# numpy version <= 1.17.
sample["signals"][np.isnan(sample["signals"])] = self.nan_val
Expand All @@ -546,7 +541,6 @@ def __init__(self, axis=0, p=0.5):
self.p = p

def __call__(self, sample):

if random.random() > self.p:
# Nothing to do
return sample
Expand Down Expand Up @@ -575,7 +569,6 @@ def __init__(self, max_crop_fraction):
self.max_crop_fraction = max_crop_fraction

def __call__(self, sample):

width = sample["signals"].shape[0]

crop_fraction = random.uniform(0.0, self.max_crop_fraction)
Expand Down Expand Up @@ -716,7 +709,6 @@ def __init__(
self.fraction_close = fraction_close

def __call__(self, sample):

p = random.random()

# Possibility of doing no crop at all
Expand Down
1 change: 0 additions & 1 deletion echofilter/ev2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ def ev2csv(

# Open the EV file
with echofilter.win.open_ev_file(input, ev_app) as ev_file:

# Find the right variable
av = ev_file.Variables.FindByName(variable_name).AsVariableAcoustic()

Expand Down
1 change: 0 additions & 1 deletion echofilter/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,6 @@ def run_inference(
# Make a temporary directory in case we are not caching generated csvs
# Directory and all its contents are deleted when we leave this context
with tempfile.TemporaryDirectory() as tmpdirname:

# Convert ev file to csv, if necessary
ev2csv_dir = cache_csv
if ev2csv_dir is None:
Expand Down
1 change: 0 additions & 1 deletion echofilter/nn/modules/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class DepthwiseConv2d(nn.Conv2d):
def __init__(
self, in_channels, kernel_size=3, stride=1, padding="same", dilation=1, **kwargs
):

if "groups" in kwargs:
raise ValueError(
"Number of groups must equal number of input channels for a depthwise convolution."
Expand Down
2 changes: 1 addition & 1 deletion echofilter/nn/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __init__(
mapping_extra = {}
for key in mapping:
for alias_map in self.aliases:
for (alias_a, alias_b) in [alias_map, alias_map[::-1]]:
for alias_a, alias_b in [alias_map, alias_map[::-1]]:
if "_" + alias_a not in key:
continue
alt_key = key.replace("_" + alias_a, "_" + alias_b)
Expand Down
1 change: 0 additions & 1 deletion echofilter/optim/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def __init__(
pct_end=0.75,
**kwargs,
):

# Validate pct_start
if not isinstance(pct_start, float) or pct_start < 0 or pct_start > 1:
raise ValueError(
Expand Down
2 changes: 0 additions & 2 deletions echofilter/optim/torch_backports.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class _LRScheduler(object):
"""

def __init__(self, optimizer, last_epoch=-1):

# Attach optimizer
if not isinstance(optimizer, Optimizer):
raise TypeError("{} is not an Optimizer".format(type(optimizer).__name__))
Expand Down Expand Up @@ -359,7 +358,6 @@ def __init__(
final_div_factor=1e4,
last_epoch=-1,
):

# Validate optimizer
if not isinstance(optimizer, Optimizer):
raise TypeError("{} is not an Optimizer".format(type(optimizer).__name__))
Expand Down
3 changes: 0 additions & 3 deletions echofilter/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ def train(
print("Starting training")
t_start = time.time()
for epoch in range(start_epoch, n_epoch + 1):

t_epoch_start = time.time()

# Set the seed state at the start of each epoch
Expand Down Expand Up @@ -1187,7 +1186,6 @@ def train_epoch(

# Measure and record performance with various metrics
for chn_cond, meters_k in meters.items():

chnparts = chn_cond.split("|")
chn = chnparts[0].lower()
if len(chnparts) < 2:
Expand Down Expand Up @@ -1423,7 +1421,6 @@ def validate(

# Measure and record performance with various metrics
for chn_cond, meters_k in meters.items():

chnparts = chn_cond.split("|")
chn = chnparts[0].lower()
if len(chnparts) < 2:
Expand Down
1 change: 0 additions & 1 deletion echofilter/ui/checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ def load_checkpoint(
checkpoint = torch.load(ckpt_path, **load_args)

except pickle.UnpicklingError:

msg = "Error: Unable to load checkpoint {}.".format(
os.path.abspath(ckpt_path)
)
Expand Down
Loading

0 comments on commit af036f3

Please sign in to comment.