Skip to content

Commit b8adcea

Browse files
committed
fix: F841 (unused variables)
After deleting variables, some bare expressions were deleted: Bare expressions deleted (no side effects — entire line removed): File: brain_observatory/circle_plots.py Deleted expression: r * np.cos(angle), r * np.sin(angle) Why: Pure arithmetic ──────────────────────────────────────── File: brain_observatory/ecephys/.../view_blocks.py Deleted expression: recorded_blocks[0] → pass Why: Bare index in else clause ──────────────────────────────────────── File: brain_observatory/eye_tracking/.../DLC_Ellipse_Fitting.py Deleted expression: 1-frac_completed Why: Pure arithmetic ──────────────────────────────────────── File: internal/brain_observatory/demix_report.py Deleted expression: np.zeros(mask.shape) Why: Array allocated and discarded ──────────────────────────────────────── File: internal/brain_observatory/frame_stream.py Deleted expression: np.prod(self.frame_shape) Why: Pure computation ──────────────────────────────────────── File: internal/brain_observatory/roi_filter.py Deleted expression: create_feature_array(...) → pass Why: Returns value, no mutation ──────────────────────────────────────── File: internal/ephys/plot_qc_figures.py Deleted expression: cell_features["long_squares"]["sweeps"] Why: Dict lookup ──────────────────────────────────────── File: internal/ephys/plot_qc_figures3.py Deleted expression: cell_features["long_squares"]["sweeps"] Why: Dict lookup ──────────────────────────────────────── File: internal/model/GLM.py Deleted expression: kbasprs['b'] Why: Dict lookup ──────────────────────────────────────── File: internal/model/biophysical/fit_stage_1.py Deleted expression: neuronal_model_data['specimen_id'] Why: Dict lookup ──────────────────────────────────────── File: internal/model/biophysical/make_deap_fit_json.py Deleted expression: os.path.realpath(os.curdir) Why: Pure path op ──────────────────────────────────────── File: internal/model/biophysical/passive_fitting/preprocess.py Deleted expression: down_idxs[1] - down_idxs[0] Why: Pure arithmetic ──────────────────────────────────────── File: internal/model/glif/error_functions.py Deleted expression: input_data['subthreshold_long_square_voltage_variance'], np.arange(...)*experiment.neuron.dt, [e.data['interpolated_ISI']] (dead code after raise) Why: Dict lookup, pure computation, unreachable ──────────────────────────────────────── File: internal/model/glif/preprocess_neuron.py Deleted expression: sweep_index[...][RESTING_POTENTIAL]*1e-3, long_square_config['all'], long_square_config['subthreshold'], np.mean(El_test_list) Why: Dict lookups, pure computation ──────────────────────────────────────── File: internal/model/glif/spike_cutting.py Deleted expression: np.var(xdata) Why: Pure computation ──────────────────────────────────────── File: internal/pipeline_modules/IVSCC/ephys_nwb/qc.py Deleted expression: sweep_data['response'], sweep_data['sampling_rate'] Why: Dict lookups ──────────────────────────────────────── File: internal/pipeline_modules/run_neuropil_correction.py Deleted expression: np.array([...]).mean() Why: Pure computation ──────────────────────────────────────── File: internal/pipeline_modules/run_observatory_container_thumbnails.py Deleted expression: input_file['output_json'] Why: Dict lookup ──────────────────────────────────────── File: model/glif/glif_neuron_methods.py Deleted expression: tcs['voltage'][-1] Why: Dict/index lookup ──────────────────────────────────────── File: brain_observatory/behavior/swdb/summary_figures.py Deleted expression: int(session.metadata['ophys_frame_rate']) Why: Pure type conversion Bare expressions kept (have side effects): ┌────────────────────────────────────────────────────────┬──────────────────────────────────┐ │ Expression │ Why kept │ ├────────────────────────────────────────────────────────┼──────────────────────────────────┤ │ hero_sweep.sweep_feature("adapt"/"latency"/"mean_isi") │ Forces lazy feature caching │ ├────────────────────────────────────────────────────────┼──────────────────────────────────┤ │ swp.sweep_feature("v_baseline") │ Same caching pattern │ ├────────────────────────────────────────────────────────┼──────────────────────────────────┤ │ i_vec.as_numpy() │ NEURON vector conversion │ ├────────────────────────────────────────────────────────┼──────────────────────────────────┤ │ subprocess.check_output([...]) (3 calls) │ Runs external fitting processes │ ├────────────────────────────────────────────────────────┼──────────────────────────────────┤ │ p.map(func, types) │ Multiprocessing execution │ ├────────────────────────────────────────────────────────┼──────────────────────────────────┤ │ description.manifest.get_path(...) │ Manifest path resolution │ ├────────────────────────────────────────────────────────┼──────────────────────────────────┤ │ plt.subplot2grid(...) │ Creates subplot in figure layout │ ├────────────────────────────────────────────────────────┼──────────────────────────────────┤ │ All allensdk/test/ expressions │ Smoke tests exercising APIs │ └────────────────────────────────────────────────────────┴──────────────────────────────────┘
1 parent a1e1084 commit b8adcea

74 files changed

Lines changed: 180 additions & 258 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

allensdk/api/queries/cell_types_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def save_ephys_data(self, specimen_id, file_name):
330330
try:
331331
file_url = results[0]['ephys_result'][
332332
'well_known_files'][0]['download_link']
333-
except Exception as _:
333+
except Exception as _: # noqa: F841
334334
raise Exception("Specimen %d has no ephys data" % specimen_id)
335335

336336
self.retrieve_file_over_http(self.api_url + file_url, file_name)

allensdk/brain_observatory/behavior/swdb/summary_figures.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def plot_max_proj_and_roi_masks(session, save_dir=None):
383383
mask = np.empty(session.segmentation_mask_image.data.shape, dtype='float')
384384
mask[:] = np.nan
385385
mask[tmp > 0] = 1
386-
cax = ax[2].imshow(mask, cmap='hsv', alpha=0.4, vmin=0, vmax=1)
386+
ax[2].imshow(mask, cmap='hsv', alpha=0.4, vmin=0, vmax=1)
387387

388388
if save_dir:
389389
ut.save_figure(fig, figsize, save_dir, 'roi_masks', str(session.metadata['ophys_experiment_id']))
@@ -445,9 +445,6 @@ def plot_experiment_summary_figure(session, save_dir=None):
445445
title = meta['driver_line'][0] + ', ' + meta['targeted_structure'] + ', ' + str(meta['imaging_depth']) + ', ' + \
446446
session.task_parameters['stage']
447447

448-
interval_seconds = 600
449-
ophys_frame_rate = int(session.metadata['ophys_frame_rate'])
450-
451448
figsize = [2 * 11, 2 * 8.5]
452449
fig = plt.figure(figsize=figsize, facecolor='white')
453450

allensdk/brain_observatory/behavior/sync/process_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def filter_digital(rising, falling, threshold=0.0001):
3333

3434
def calculate_delay(sync_data, stim_vsync_fall, sample_frequency):
3535
# from http://stash.corp.alleninstitute.org/projects/INF/repos/lims2_modules/browse/CAM/ophys_time_sync/ophys_time_sync.py
36-
ASSUMED_DELAY = 0.0351
3736
DELAY_THRESHOLD = 0.001
3837
FIRST_ELEMENT_INDEX = 0
3938
ROUND_PRECISION = 4

allensdk/brain_observatory/brain_observatory_plotting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def _plot_3sb(sg, nm1, ns, save_dir):
670670
ax1 = plt.subplot2grid((6, 6), (0, 0), colspan=4) # full trace
671671
ax2 = plt.subplot2grid((6, 6), (0, 4)) # histogram of F
672672
ax14 = plt.subplot2grid((6, 6), (1, 4)) # speed tuning
673-
ax16 = plt.subplot2grid((6, 6), (1, 5), sharex=ax14, sharey=ax14)
673+
plt.subplot2grid((6, 6), (1, 5), sharex=ax14, sharey=ax14)
674674
ax15 = plt.subplot2grid((6, 6), (1, 0), colspan=4)
675675
ax3 = plt.subplot2grid((6, 6), (2, 0), colspan=2) # Ori tuning
676676
ax4 = plt.subplot2grid((6, 6), (2, 2), colspan=2) # sf tuning

allensdk/brain_observatory/circle_plots.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,6 @@ def show_group_labels(self, groups=None, color=None, fontdict=None):
611611
r = self.inner_radius*.5
612612
angle = 90.0
613613

614-
x = r * np.cos(angle)
615-
y = r * np.sin(angle)
616-
617614
for group in groups:
618615
off = self.group_offset_map[group]
619616

allensdk/brain_observatory/ecephys/stimulus_table/visualization/view_blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_blocks(table):
4242
)
4343
)
4444
else:
45-
recorded_block = recorded_blocks[0]
45+
pass
4646

4747
start = block["Start"].values[0]
4848
end = block["End"].values[-1]

allensdk/brain_observatory/eye_tracking/stage_2/DLC_Ellipse_Fitting.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def fit_ellipse(h5name):
6161
#fit ellipses to the pupil & eye points in 4/25
6262

6363
frac_completed = max(1,float(j))/len(df)
64-
frac_rem = 1-frac_completed
6564
tot_time_est = (time.time() - loop_t0)/frac_completed
6665
progress_str = "{:10.2f} {:10.2f} {:5s} {:10.2f}".format(time.time()-last_loop_time, time.time()-loop_t0, "{0:.0%}".format(frac_completed), tot_time_est)
6766
logger.info('Ellipse fit: {}'.format(progress_str))

allensdk/brain_observatory/observatory_plots.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def plot_cell_correlation(sig_corrs, labels, colors, scale=15):
7171
alpha = 1.0
7272

7373
ax = plt.gca()
74-
ps = []
7574
for sig_corr, color, label in zip(sig_corrs, colors, labels):
7675
ax.hist(sig_corr, bins=30, range=[-1,1],
7776
histtype='stepfilled',

allensdk/ephys/extract_cell_features.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ def extract_cell_features(data_set,
137137
hero_sweep = sweep
138138

139139
if hero_sweep:
140-
adapt = hero_sweep.sweep_feature("adapt")
141-
latency = hero_sweep.sweep_feature("latency")
142-
mean_isi = hero_sweep.sweep_feature("mean_isi")
140+
hero_sweep.sweep_feature("adapt")
141+
hero_sweep.sweep_feature("latency")
142+
hero_sweep.sweep_feature("mean_isi")
143143
else:
144144
raise ft.FeatureError("Could not find hero sweep.")
145145

allensdk/ephys/feature_extractor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ def process_instance(self, name, v, curr, t, onset, dur, stim_name):
397397
close_idx += 1
398398
spk["downstroke"] = dvdt[close_idx]
399399

400-
features = {}
401400
feature.mean["base_v"] = v[np.where((t > onset - 0.1) & (t < onset - 0.001))].mean() # baseline voltage, 100ms before stim
402401
feature.mean["spikes"] = spikes
403402
isi_cv = self.isicv(spikes)

0 commit comments

Comments
 (0)