From a2b1e5bd34f0d46badc5877bb64ca33ea807a905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Offringa?= <offringa@astron.nl> Date: Thu, 2 Feb 2023 13:08:03 +0100 Subject: [PATCH] Reformat code with newest black version --- .cmake-format.py | 6 ------ scripts/coeff_scripts/convert_lobes.py | 10 ++++++++-- scripts/coeff_scripts/oskar_csv_to_hdf5.py | 1 - scripts/misc/F4far_new.py | 1 - scripts/misc/calc_modes_1deg_noback.py | 14 +++++++------- setup.py | 1 + 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.cmake-format.py b/.cmake-format.py index 06299106..d897b090 100644 --- a/.cmake-format.py +++ b/.cmake-format.py @@ -2,7 +2,6 @@ # Options affecting listfile parsing # ---------------------------------- with section("parse"): - # Specify structure for custom cmake functions additional_commands = { "foo": { @@ -24,7 +23,6 @@ with section("parse"): # Options affecting formatting. # ----------------------------- with section("format"): - # Disable formatting entirely, making cmake-format a no-op disable = False @@ -122,7 +120,6 @@ with section("format"): # Options affecting comment reflow and formatting. # ------------------------------------------------ with section("markup"): - # What character to use for bulleted lists bullet_char = "*" @@ -166,7 +163,6 @@ with section("markup"): # Options affecting the linter # ---------------------------- with section("lint"): - # a list of lint codes to disable disabled_codes = [] @@ -223,7 +219,6 @@ with section("lint"): # Options affecting file encoding # ------------------------------- with section("encode"): - # If true, emit the unicode byte-order mark (BOM) at the start of the file emit_byteorder_mark = False @@ -238,7 +233,6 @@ with section("encode"): # Miscellaneous configurations options. # ------------------------------------- with section("misc"): - # A dictionary containing any per-command configuration overrides. Currently # only `command_case` is supported. per_command = {} diff --git a/scripts/coeff_scripts/convert_lobes.py b/scripts/coeff_scripts/convert_lobes.py index bea4f02b..d217eb34 100755 --- a/scripts/coeff_scripts/convert_lobes.py +++ b/scripts/coeff_scripts/convert_lobes.py @@ -504,7 +504,10 @@ def main(): element_select=element_select, ) # Please note that freqs have to be converted from MHz to Hz! - F, pT, = fit_and_write_lobes_coeffs( + ( + F, + pT, + ) = fit_and_write_lobes_coeffs( h5data["theta"], h5data["phi"], h5data["freq"] * 1e6, @@ -536,7 +539,10 @@ def main(): positions = read_lofar_antenna_positions(f"{station}LBA") simdata = read_simulation_files(path) - F, pT, = fit_and_write_lobes_coeffs( + ( + F, + pT, + ) = fit_and_write_lobes_coeffs( simdata["theta"], simdata["phi"], simdata["freq"], diff --git a/scripts/coeff_scripts/oskar_csv_to_hdf5.py b/scripts/coeff_scripts/oskar_csv_to_hdf5.py index f9cb9495..6cfc96fd 100755 --- a/scripts/coeff_scripts/oskar_csv_to_hdf5.py +++ b/scripts/coeff_scripts/oskar_csv_to_hdf5.py @@ -63,7 +63,6 @@ if debug: # Parse all freqs for freq in tqdm(freqs): - A = None for i, pol in enumerate(("x", "y")): diff --git a/scripts/misc/F4far_new.py b/scripts/misc/F4far_new.py index 2712df64..c55120b7 100644 --- a/scripts/misc/F4far_new.py +++ b/scripts/misc/F4far_new.py @@ -105,7 +105,6 @@ def F41(m, n, theta, phi, beta): def F42(m, n, theta, phi, beta): - if m != 0: C = ( beta diff --git a/scripts/misc/calc_modes_1deg_noback.py b/scripts/misc/calc_modes_1deg_noback.py index 2d7df05c..84b6fd35 100755 --- a/scripts/misc/calc_modes_1deg_noback.py +++ b/scripts/misc/calc_modes_1deg_noback.py @@ -19,9 +19,9 @@ coords = loadmat("CS302_coords") simdata = loadmat("LBA_CS302_fine") -#% -#% Compensate phase for element position -#% +# % +# % Compensate phase for element position +# % P = coords["LBA"]["P"][0, 0][:, 0] Q = coords["LBA"]["Q"][0, 0][:, 0] @@ -119,7 +119,7 @@ with h5py.File("LBA_CS302.hdf5", "w") as f: # Erecon=F*Q; # E=reshape(E,length(Theta),length(Phi),2); # Erecon=reshape(Erecon,length(Theta),length(Phi),2); -#% +# % # h1=figure; # plot(Theta,20.*log10(abs(E(:,Phi==45,1))),'b') # grid on @@ -152,7 +152,7 @@ with h5py.File("LBA_CS302.hdf5", "w") as f: # xlabel('Theta (degrees)') # ylabel('degrees') # title({['EEP element 1, \phi=135 deg., freq. ' num2str(Freq(FreqN)./1e6) ' MHz'],'\phi-component (phase)'}) -#% +# % # Diff=Erecon./E; # h5=figure; # plot(Theta,20.*log10(abs(Diff(:,Phi==45,1))),'b') @@ -174,7 +174,7 @@ with h5py.File("LBA_CS302.hdf5", "w") as f: # legend('\theta-comp., \phi=45^\circ','\phi-comp., \phi=135^\circ') # title({'Difference between original and','reconstructed EEP (phase)', ... # ['Element ' num2str(El) ', freq. ' num2str(Freq(FreqN)./1e6) ' MHz']}) -#% +# % # figure(h1) # legend('original','reconstructed') # figure(h2) @@ -188,7 +188,7 @@ with h5py.File("LBA_CS302.hdf5", "w") as f: # grid on # xlabel('Index number') # title('Absolute value of calculated coefficients') -#% +# % # disp(['Least square error = ' num2str(norm(E(:)-F*pinv(F)*E(:),2))]) # disp(['Condition number F = ' num2str(cond(F))]) # disp(['Size F = ' num2str(size(F))]) diff --git a/setup.py b/setup.py index d29a1cde..e0311827 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ from setuptools.command.build_ext import build_ext # Set the location where data files are to be installed EVERYBEAM_DATADIR = os.path.join("share", "everybeam") + # A CMakeExtension needs a sourcedir instead of a file list. # The name must be the _single_ output extension from the CMake build. # If you need multiple extensions, see scikit-build. -- GitLab