Skip to content

Commit d977b57

Browse files
authored
Change all user message quotation marks to double quotation marks (#1311)
1 parent 68f5ece commit d977b57

File tree

179 files changed

+1636
-1628
lines changed

Some content is hidden

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

179 files changed

+1636
-1628
lines changed

.github/workflows/nestml-build.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,19 @@ jobs:
3434

3535
- name: Install Python dependencies
3636
run: |
37-
python -m pip install --upgrade pycodestyle
37+
python -m pip install --upgrade pycodestyle flake8 flake8-quotes
38+
39+
- name: Check copyright headers
40+
run: |
41+
python3 extras/codeanalysis/check_copyright_headers.py
42+
43+
- name: Check that strings use double quotes
44+
run: |
45+
flake8 --select=Q000 --inline-quotes="double" --multiline-quotes="double" --docstring-quotes="double" --exclude=$GITHUB_WORKSPACE/doc,$GITHUB_WORKSPACE/.git,$GITHUB_WORKSPACE/NESTML.egg-info,$GITHUB_WORKSPACE/pynestml/generated,$GITHUB_WORKSPACE/extras,$GITHUB_WORKSPACE/build,$GITHUB_WORKSPACE/.github
3846
3947
- name: Static code style analysis
4048
run: |
41-
python3 extras/codeanalysis/check_copyright_headers.py && python3 -m pycodestyle $GITHUB_WORKSPACE -v --ignore=E241,E501,E714,E713,E714,E252,W503 --exclude=$GITHUB_WORKSPACE/doc,$GITHUB_WORKSPACE/.git,$GITHUB_WORKSPACE/NESTML.egg-info,$GITHUB_WORKSPACE/pynestml/generated,$GITHUB_WORKSPACE/extras,$GITHUB_WORKSPACE/build,$GITHUB_WORKSPACE/.github
49+
python3 -m pycodestyle $GITHUB_WORKSPACE -v --ignore=E241,E501,E714,E713,E714,E252,W503 --exclude=$GITHUB_WORKSPACE/doc,$GITHUB_WORKSPACE/.git,$GITHUB_WORKSPACE/NESTML.egg-info,$GITHUB_WORKSPACE/pynestml/generated,$GITHUB_WORKSPACE/extras,$GITHUB_WORKSPACE/build,$GITHUB_WORKSPACE/.github
4250
4351
grammar_check:
4452
# check consistency of the grammar and lexer/parser: verify that when generated by Antlr, the lexer/parser are identical to the ones in the repository

extras/benchmark/Running/benchmark.py

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
max_int32 = np.iinfo(np.int32).max
6161

6262
# parse command line arguments
63-
parser = argparse.ArgumentParser(description='Run a Benchmark with NEST')
64-
parser.add_argument('--noRunSim', action="store_false", help='Skip running simulations, only do plotting')
65-
parser.add_argument('--enable_profiling', action="store_true", help="Run the benchmark with profiling enabled with AMDuProf")
63+
parser = argparse.ArgumentParser(description="Run a Benchmark with NEST")
64+
parser.add_argument("--noRunSim", action="store_false", help="Skip running simulations, only do plotting")
65+
parser.add_argument("--enable_profiling", action="store_true", help="Run the benchmark with profiling enabled with AMDuProf")
6666
parser.add_argument("--short_sim", action="store_true", help="Run benchmark with profiling on 2 nodes with 2 iterations")
6767
parser.add_argument("--enable_mpi", action="store_true", default=False, help="Run benchmark with MPI (default: thread-based benchmarking)")
6868

@@ -129,9 +129,9 @@
129129

130130
# output folder
131131
if args.enable_mpi:
132-
output_folder = os.path.join(os.path.dirname(__file__), os.pardir, 'Output_MPI')
132+
output_folder = os.path.join(os.path.dirname(__file__), os.pardir, "Output_MPI")
133133
else:
134-
output_folder = os.path.join(os.path.dirname(__file__), os.pardir, 'Output_threads')
134+
output_folder = os.path.join(os.path.dirname(__file__), os.pardir, "Output_threads")
135135

136136

137137
def log(message):
@@ -169,7 +169,7 @@ def start_strong_scaling_benchmark_threads(iteration):
169169
for combination in combinations:
170170
rng_seed = rng.integers(0, max_int32)
171171

172-
command = ['bash', '-c', f'source {PATHTOSTARTFILE} && python3 {PATHTOFILE} --simulated_neuron {combination["neuronmodel"]} --network_scale {MPI_STRONG_SCALE_NEURONS} --threads {combination["n_threads"]} --iteration {iteration} --rng_seed {rng_seed} --benchmarkPath {dirname}']
172+
command = ["bash", "-c", f'source {PATHTOSTARTFILE} && python3 {PATHTOFILE} --simulated_neuron {combination["neuronmodel"]} --network_scale {MPI_STRONG_SCALE_NEURONS} --threads {combination["n_threads"]} --iteration {iteration} --rng_seed {rng_seed} --benchmarkPath {dirname}']
173173

174174
log(combination["name"])
175175

@@ -188,7 +188,7 @@ def start_strong_scaling_benchmark_threads(iteration):
188188
f.write(result.stderr)
189189

190190
if result.returncode != 0:
191-
log(f"\033[91m{combination['name']} failed\033[0m")
191+
log(f"\033[91m{combination["name"]} failed\033[0m")
192192
log(f"\033[91m{result.stderr} failed\033[0m")
193193

194194
def start_strong_scaling_benchmark_mpi(iteration):
@@ -231,7 +231,7 @@ def start_weak_scaling_benchmark_threads(iteration):
231231
for combination in combinations:
232232
rng_seed = rng.integers(0, max_int32)
233233

234-
command = ['bash', '-c', f'source {PATHTOSTARTFILE} && python3 {PATHTOFILE} --simulated_neuron {combination["neuronmodel"]} --network_scale {NETWORK_BASE_SCALE * combination["n_threads"]} --threads {combination["n_threads"]} --rng_seed {rng_seed} --iteration {iteration} --benchmarkPath {dirname}']
234+
command = ["bash", "-c", f'source {PATHTOSTARTFILE} && python3 {PATHTOFILE} --simulated_neuron {combination["neuronmodel"]} --network_scale {NETWORK_BASE_SCALE * combination["n_threads"]} --threads {combination["n_threads"]} --rng_seed {rng_seed} --iteration {iteration} --benchmarkPath {dirname}']
235235

236236
combined = combination["neuronmodel"]+","+str(combination["networksize"])
237237
log(f"\033[93m{combined}\033[0m" if DEBUG else combined)
@@ -248,7 +248,7 @@ def start_weak_scaling_benchmark_threads(iteration):
248248
f.write(result.stderr)
249249

250250
if result.returncode != 0:
251-
log(f"\033[91m{combination['neuronmodel']} failed\033[0m")
251+
log(f"\033[91m{combination["neuronmodel"]} failed\033[0m")
252252
log(f"\033[91m{result.stderr} failed\033[0m")
253253

254254
def start_weak_scaling_benchmark_mpi(iteration):
@@ -321,15 +321,15 @@ def _plot_scaling_data(ax, sim_data: dict, file_prefix: str, abs_or_rel: str):
321321
x = sorted(values.keys(), key=lambda k: int(k))
322322
# Real Time Factor
323323
reference_y = np.array([np.mean(
324-
[iteration_data['max_time_simulate'] / (iteration_data["biological_time"] / 1000) for iteration_data in
324+
[iteration_data["max_time_simulate"] / (iteration_data["biological_time"] / 1000) for iteration_data in
325325
referenceValues[nodes].values()]) for nodes in x])
326326
y = np.array([np.mean(
327-
[iteration_data['max_time_simulate'] / (iteration_data["biological_time"] / 1000) for iteration_data in
327+
[iteration_data["max_time_simulate"] / (iteration_data["biological_time"] / 1000) for iteration_data in
328328
values[nodes].values()]) for nodes in x])
329329
y_factor = y / reference_y # Calculate the factor of y in comparison to the reference value
330330

331331
y_std = np.array([np.std(
332-
[iteration_data['max_time_simulate'] / (iteration_data["biological_time"] / 1000) for iteration_data in
332+
[iteration_data["max_time_simulate"] / (iteration_data["biological_time"] / 1000) for iteration_data in
333333
values[nodes].values()]) for nodes in x])
334334
y_factor_std = y_std / reference_y # Calculate the standard deviation of the factor
335335

@@ -343,7 +343,7 @@ def _plot_scaling_data(ax, sim_data: dict, file_prefix: str, abs_or_rel: str):
343343
_y_std = y_std / 60
344344
_y = y / 60
345345

346-
ax.errorbar(x, _y, yerr=_y_std, label=legend[neuron], color=palette(colors[neuron]), linestyle='-',marker='o', markersize=4, ecolor='gray', capsize=2, linewidth=2)
346+
ax.errorbar(x, _y, yerr=_y_std, label=legend[neuron], color=palette(colors[neuron]), linestyle="-",marker="o", markersize=4, ecolor="gray", capsize=2, linewidth=2)
347347

348348
min_y = min(min_y, np.amin(_y))
349349
max_y = max(max_y, np.amax(_y))
@@ -372,18 +372,18 @@ def plot_scaling_data(sim_data_weak: dict, sim_data_strong: dict, file_prefix: s
372372
max_y = max(_max_y, max_y)
373373

374374
if abs_or_rel == "abs":
375-
ax[i, 0].set_ylabel('Wall clock time [min]')
376-
ax[i, 0].set_yscale('log')
375+
ax[i, 0].set_ylabel("Wall clock time [min]")
376+
ax[i, 0].set_yscale("log")
377377
else:
378-
ax[i, 0].set_ylabel('Wall clock time (ratio)')
378+
ax[i, 0].set_ylabel("Wall clock time (ratio)")
379379
ax[i, 1].set_yticklabels([]) # hide y tick labels from bottom right plot, ticks/labels are same as for bottom left
380380

381381
# column labels
382382
ax[0, 0].text(0.5, 1.1, "Strong scaling", transform=ax[0, 0].transAxes, ha="center", fontsize=16)
383383
ax[0, 1].text(0.5, 1.1, "Weak scaling", transform=ax[0, 1].transAxes, ha="center", fontsize=16)
384384

385385
for _ax in ax.flatten():
386-
_ax.set_xscale('log')
386+
_ax.set_xscale("log")
387387
_ax.xaxis.set_minor_locator(matplotlib.ticker.NullLocator())
388388

389389
ax[0, 0].legend()
@@ -396,14 +396,14 @@ def plot_scaling_data(sim_data_weak: dict, sim_data_strong: dict, file_prefix: s
396396

397397
if args.enable_mpi:
398398
for _ax in ax[1, :]:
399-
_ax.set_xlabel('Number of nodes')
399+
_ax.set_xlabel("Number of nodes")
400400

401401
for _ax in ax.flatten():
402402
_ax.set_xlim(MPI_SCALES[0], MPI_SCALES[-1])
403403
_ax.set_xticks(MPI_SCALES, MPI_SCALES)
404404
else:
405405
for _ax in ax[1, :]:
406-
_ax.set_xlabel('Number of threads')
406+
_ax.set_xlabel("Number of threads")
407407

408408
for _ax in ax.flatten():
409409
_ax.set_xlim(N_THREADS[0], N_THREADS[-1])
@@ -419,10 +419,10 @@ def plot_scaling_data(sim_data_weak: dict, sim_data_strong: dict, file_prefix: s
419419

420420

421421
for _ax in ax.flatten():
422-
_ax.spines['top'].set_visible(False)
423-
_ax.spines['right'].set_visible(False)
424-
_ax.spines['left'].set_visible(False)
425-
_ax.spines['bottom'].set_visible(False)
422+
_ax.spines["top"].set_visible(False)
423+
_ax.spines["right"].set_visible(False)
424+
_ax.spines["left"].set_visible(False)
425+
_ax.spines["bottom"].set_visible(False)
426426

427427
for _ax in ax[0, :]:
428428
_ax.set_xticklabels([]) # hide x tick labels for number of threads/processes from top two panels
@@ -483,15 +483,15 @@ def plot_memory_scaling_benchmark(sim_data: dict, file_prefix: str):
483483
_y = rss
484484
_y_std = rss_std
485485

486-
_ax.errorbar(x, _y, yerr=_y_std, color=palette(colors[neuron]), linestyle=linestyles["rss"], label=legend[neuron], ecolor='gray', capsize=2, linewidth=2, marker='o', markersize=4)
486+
_ax.errorbar(x, _y, yerr=_y_std, color=palette(colors[neuron]), linestyle=linestyles["rss"], label=legend[neuron], ecolor="gray", capsize=2, linewidth=2, marker="o", markersize=4)
487487
print("mem for neuron " + neuron + " = " + str(_y) + ", std dev = " + str(_y_std))
488488

489489
if abs_or_rel == "abs":
490-
_ax.set_yscale('log')
490+
_ax.set_yscale("log")
491491

492-
ax[0].legend(loc='upper left')
493-
ax[0].set_ylabel('Memory [GiB]')
494-
ax[1].set_ylabel('Memory (ratio)')
492+
ax[0].legend(loc="upper left")
493+
ax[0].set_ylabel("Memory [GiB]")
494+
ax[1].set_ylabel("Memory (ratio)")
495495
# Create a legend for the neurons
496496
# neuron_handles = [plt.Line2D([0], [0], color=palette(colors[key]), lw=2) for key in legend.keys()]
497497
for _ax in [ax[1]]:
@@ -501,27 +501,27 @@ def plot_memory_scaling_benchmark(sim_data: dict, file_prefix: str):
501501
_ax.yaxis.set_major_formatter(formatter)
502502

503503
for _ax in ax:
504-
_ax.set_xscale('log')
504+
_ax.set_xscale("log")
505505
_ax.xaxis.set_minor_locator(matplotlib.ticker.NullLocator())
506506

507-
_ax.spines['top'].set_visible(False)
508-
_ax.spines['right'].set_visible(False)
509-
_ax.spines['left'].set_visible(False)
510-
_ax.spines['bottom'].set_visible(False)
507+
_ax.spines["top"].set_visible(False)
508+
_ax.spines["right"].set_visible(False)
509+
_ax.spines["left"].set_visible(False)
510+
_ax.spines["bottom"].set_visible(False)
511511

512512
if args.enable_mpi:
513-
_ax.set_xlabel('Number of nodes')
513+
_ax.set_xlabel("Number of nodes")
514514
_ax.set_xticks(MPI_SCALES, MPI_SCALES)
515515
_ax.set_xlim(MPI_SCALES[0], MPI_SCALES[-1])
516516
else:
517-
_ax.set_xlabel('Number of threads')
517+
_ax.set_xlabel("Number of threads")
518518
_ax.set_xticks(N_THREADS, N_THREADS)
519519
_ax.set_xlim(N_THREADS[0], N_THREADS[-1])
520520

521521
fig.subplots_adjust(left=0.2, right=.9, bottom=0.15, top=0.9)
522522

523-
fig.savefig(os.path.join(output_folder, file_prefix + '_memory.png'))
524-
fig.savefig(os.path.join(output_folder, file_prefix + '_memory.pdf'))
523+
fig.savefig(os.path.join(output_folder, file_prefix + "_memory.png"))
524+
fig.savefig(os.path.join(output_folder, file_prefix + "_memory.pdf"))
525525

526526

527527
def process_data(dir_name: str, mode="MPI"):
@@ -636,7 +636,7 @@ def read_isis_from_files(neuron_models):
636636

637637
print("Reading ISIs from: " + os.path.join(output_folder, filename))
638638

639-
with open(os.path.join(output_folder, filename), 'r') as file:
639+
with open(os.path.join(output_folder, filename), "r") as file:
640640
isis = [float(line.strip()) for line in file]
641641
if iteration >= len(data[neuron_model]["isis"]):
642642
data[neuron_model]["isis"].append([])
@@ -732,21 +732,21 @@ def plot_isi_distributions(neuron_models, data):
732732
plt.bar(data["bin_centers"], 100 * 2 * data[neuron_model]["counts_std"], data["bin_centers"][1] - data["bin_centers"][0], bottom=100 * (data[neuron_model]["counts_mean"] - data[neuron_model]["counts_std"]), alpha=.5, color=palette(colors[neuron_model]))
733733
plt.step(data["bin_edges"][:-1], 100 * data[neuron_model]["counts_mean"], label=legend[neuron_model], linewidth=2, alpha=.5, where="post", color=palette(colors[neuron_model]))
734734

735-
plt.xlabel('ISI [ms]')
736-
plt.ylabel('Frequency of occurrence [%]')
735+
plt.xlabel("ISI [ms]")
736+
plt.ylabel("Frequency of occurrence [%]")
737737
plt.grid(True)
738738
plt.subplots_adjust(left=0.2, right=.9, bottom=0.15, top=0.9)
739739
plt.legend()
740740

741741
plt.xlim(0, 160) # XXX hard-coded...
742742

743-
plt.gca().spines['top'].set_visible(False)
744-
plt.gca().spines['right'].set_visible(False)
745-
plt.gca().spines['left'].set_visible(False)
746-
plt.gca().spines['bottom'].set_visible(False)
743+
plt.gca().spines["top"].set_visible(False)
744+
plt.gca().spines["right"].set_visible(False)
745+
plt.gca().spines["left"].set_visible(False)
746+
plt.gca().spines["bottom"].set_visible(False)
747747

748-
plt.savefig(os.path.join(output_folder, 'isi_distributions.png'))
749-
plt.savefig(os.path.join(output_folder, 'isi_distributions.pdf'))
748+
plt.savefig(os.path.join(output_folder, "isi_distributions.png"))
749+
plt.savefig(os.path.join(output_folder, "isi_distributions.pdf"))
750750

751751

752752
if __name__ == "__main__":

extras/benchmark/Running/brunel_alpha_nest.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ def convert_np_arrays_to_lists(obj):
185185

186186
def _VmB(VmKey):
187187
r"""This code is from beNNch, https://github.com/INM-6/beNNch-models/, 2024-05-18"""
188-
_proc_status = '/proc/%d/status' % os.getpid()
189-
_scale = {'kB': 1024.0, 'mB': 1024.0 * 1024.0, 'KB': 1024.0, 'MB': 1024.0 * 1024.0}
188+
_proc_status = "/proc/%d/status" % os.getpid()
189+
_scale = {"kB": 1024.0, "mB": 1024.0 * 1024.0, "KB": 1024.0, "MB": 1024.0 * 1024.0}
190190
# get pseudo file /proc/<pid>/status
191191
try:
192192
t = open(_proc_status)
@@ -205,17 +205,17 @@ def _VmB(VmKey):
205205

206206
def get_vmsize(since=0.0):
207207
"""Return memory usage in bytes."""
208-
return _VmB('VmSize:') - since
208+
return _VmB("VmSize:") - since
209209

210210

211211
def get_rss(since=0.0):
212212
"""Return resident memory usage in bytes."""
213-
return _VmB('VmRSS:') - since
213+
return _VmB("VmRSS:") - since
214214

215215

216216
def get_vmpeak(since=0.0):
217217
"""Return peak memory usage in bytes."""
218-
return _VmB('VmPeak:') - since
218+
return _VmB("VmPeak:") - since
219219

220220

221221
###############################################################################
@@ -267,9 +267,9 @@ def plot_interspike_intervals(spike_times_list, path, fname_snip=""):
267267

268268
# Plot the distribution of interspike intervals
269269
plt.figure(figsize=(6, 4))
270-
plt.hist(interspike_intervals, bins=30, edgecolor='black', alpha=0.75)
271-
plt.xlabel('Interspike Interval (ms)')
272-
plt.ylabel('Frequency')
270+
plt.hist(interspike_intervals, bins=30, edgecolor="black", alpha=0.75)
271+
plt.xlabel("Interspike Interval (ms)")
272+
plt.ylabel("Frequency")
273273
plt.grid(True)
274274
plt.tight_layout()
275275
plt.savefig(f"{path}/isi_distribution_" + fname_snip + ".png")
@@ -289,14 +289,14 @@ def plot_interspike_intervals(spike_times_list, path, fname_snip=""):
289289
# (1 pA) using the `Lambert W` function. Thus function will later be used to
290290
# calibrate the synaptic weights.
291291

292-
parser = argparse.ArgumentParser(description='Run a simulation with NEST')
293-
parser.add_argument('--benchmarkPath', type=str, default='', help='Path to the nest installation')
294-
parser.add_argument('--simulated_neuron', type=str, default='iaf_psc_alpha_neuron_Nestml', help='Name of the model to use')
295-
parser.add_argument('--network_scale', type=int, default=2500, help='Number of neurons to use')
296-
parser.add_argument('--nodes', type=int, default=1, required=False, help='Number of compute nodes to use')
297-
parser.add_argument('--threads', type=int, default=1, help='Number of threads to use')
298-
parser.add_argument('--iteration', type=int, help='iteration number used for the benchmark')
299-
parser.add_argument('--rng_seed', type=int, help='random seed', default=123)
292+
parser = argparse.ArgumentParser(description="Run a simulation with NEST")
293+
parser.add_argument("--benchmarkPath", type=str, default="", help="Path to the nest installation")
294+
parser.add_argument("--simulated_neuron", type=str, default="iaf_psc_alpha_neuron_Nestml", help="Name of the model to use")
295+
parser.add_argument("--network_scale", type=int, default=2500, help="Number of neurons to use")
296+
parser.add_argument("--nodes", type=int, default=1, required=False, help="Number of compute nodes to use")
297+
parser.add_argument("--threads", type=int, default=1, help="Number of threads to use")
298+
parser.add_argument("--iteration", type=int, help="iteration number used for the benchmark")
299+
parser.add_argument("--rng_seed", type=int, help="random seed", default=123)
300300
args = parser.parse_args()
301301

302302

extras/benchmark/Running/plotting_options.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
palette = plt.get_cmap("tab10")
66

7-
plt.rcParams['axes.grid'] = True
7+
plt.rcParams["axes.grid"] = True
88

9-
plt.rcParams['grid.color'] = 'gray'
10-
plt.rcParams['grid.linestyle'] = '--'
11-
plt.rcParams['grid.linewidth'] = 0.5
9+
plt.rcParams["grid.color"] = "gray"
10+
plt.rcParams["grid.linestyle"] = "--"
11+
plt.rcParams["grid.linewidth"] = 0.5
1212

13-
plt.rcParams['axes.labelsize'] = 16 # Size of the axis labels
14-
plt.rcParams['xtick.labelsize'] = 14 # Size of the x-axis tick labels
15-
plt.rcParams['ytick.labelsize'] = 14 # Size of the y-axis tick labels
16-
plt.rcParams['legend.fontsize'] = 14 # Size of the legend labels
17-
plt.rcParams['figure.titlesize'] = 16 # Size of the figure title
13+
plt.rcParams["axes.labelsize"] = 16 # Size of the axis labels
14+
plt.rcParams["xtick.labelsize"] = 14 # Size of the x-axis tick labels
15+
plt.rcParams["ytick.labelsize"] = 14 # Size of the y-axis tick labels
16+
plt.rcParams["legend.fontsize"] = 14 # Size of the legend labels
17+
plt.rcParams["figure.titlesize"] = 16 # Size of the figure title

0 commit comments

Comments
 (0)