test_campaign module

Define an object to store data from several MultipactorTest.

class TestCampaign(multipactor_tests)[source]

Bases: list[MultipactorTest]

Hold several multipactor tests together.

Parameters:

multipactor_tests (list[MultipactorTest])

classmethod from_filepaths(filepaths, frequencies, swrs, config, info=(), sep=',', trigger_policy='keep_all', index_col='Sample index', is_raw=False, **kwargs)[source]

Instantiate the MultipactorTest and TestCampaign.

Parameters:
  • filepaths (Sequence[Path]) – Filepaths to the LabViewer files.

  • frequencies (Sequence[float]) – Frequencies matching the filepaths.

  • swrs (Sequence[float]) – SWRs matching the filepaths.

  • config (dict[str, Any] | str | Path) – Configuration of the test bench.

  • info (Sequence[str], default: ()) – Other information string to identify each multipactor test.

  • sep (str, default: ',') – Delimiter between the columns.

  • trigger_policy (Literal['keep_all', 'trim', 'average', 'first', 'last', 'max', 'min'], default: 'keep_all') – How consecutive measures at the same power should be treated.

  • index_col (str, default: 'Sample index') – Name of column holding measurement index.

  • is_raw (bool, default: False) – If set to True, input data files are considered to be raw, ie to contain acquisition voltages instead of physical quantities.

Return type:

Self

Returns:

List of MultipactorTest.

add_post_treater(post_treater, instrument_class=<class 'multipac_testbench.instruments.instrument.Instrument'>)[source]

Add post-treatment functions to instruments.

Parameters:
Return type:

None

determine_thresholds(multipac_detector, instrument_class, power_growth_array_kw=None, threshold_reducer=None, threshold_predicate=None, instrument_predicate=None, **kwargs)[source]

Determine every MultipactorTest multipactor thresholds.

Parameters:
Return type:

dict[MultipactorTest, ThresholdSet]

Returns:

Objects holding all lower and upper thresholds, detected by multipac_detector applied on every instance of instrument_class for every MultipactorTest.

reconstruct_voltage_along_line(*args, **kwargs)[source]

Call all MultipactorTest.reconstruct_voltage_along_line().

Return type:

None

sweet_plot(*args, thresholds_sets=None, png_folder=None, csv_folder=None, all_on_same_plot=False, **kwargs)[source]

Recursively call MultipactorTest.sweet_plot().

Parameters:
Return type:

tuple[list[Axes], DataFrame] | tuple[list[list[Axes]], list[DataFrame]]

Returns:

  • axes – Holds plotted fig.

  • data – Holds data used to create the plot.

_sweet_plot_same_plot(*args, thresholds_sets=None, png_folder=None, png_kwargs=None, csv_folder=None, csv_kwargs=None, **kwargs)[source]

Plot the various signals on the same Axes.

Parameters:
Return type:

tuple[list[Axes], DataFrame]

Returns:

  • axes – Holds plotted fig.

  • data – Holds data used to create the plot.

plot_thresholds(to_plot, thresholds_sets, *args, png_folder=None, png_kwargs=None, csv_folder=None, all_on_same_plot=True, **kwargs)[source]

Recursively call MultipactorTest.plot_thresholds().

Parameters:
Return type:

tuple[list[list[Axes]], list[DataFrame]]

somersalo_chart(thresholds_sets, orders_one_point=(1, 2, 3, 4, 5, 6, 7), orders_two_point=(1,), **fig_kw)[source]

Create a Somersalo plot, with theoretical results and measured.

Todo

For some reason, two point is plotted on the one point ax instead of the two point…

Parameters:
  • instrument_multipactor_bands – An object holding the multipactor information for every MultipactorTest in self.

  • orders_one_point (tuple[int, ...], default: (1, 2, 3, 4, 5, 6, 7)) – The multipactor orders to plot for one point multipactor. The default is orders 1 to 8, as in Somersalo’s plot.

  • orders_two_point (tuple[int, ...], default: (1,)) – The multipactor orders to plot for two point multipactor. The default is order 1 only, as in Somersalo’s plot.

  • fig_kw – Other keyword arguments passed to the Figure constructor.

  • thresholds_sets (Mapping[MultipactorTest, ThresholdSet])

Return type:

tuple[Figure, Axes, Axes]

Returns:

  • fig – Holds the plotted figure.

  • ax1 – Left axis (one-point multipactor).

  • ax2 – Right axis (two-point multipactor).

_add_somersalo_measured(ax1, ax2, thresholds_sets, **plot_kw)[source]

Put the measured multipacting limits on Somersalo plot.

Todo

Determine what this function should precisely plot. As for now, it plots last lower and upper power barriers. Alternatives would be to plot every power that led to multipacting during last power cycle, or every power that led to multipacting during whole test.

Parameters:
Return type:

None

check_somersalo_scaling_law(thresholds_sets, show_fit=True, use_theoretical_r=False, full_output=True, add_upper_thresholds=False, axes=None, png_path=None, png_kwargs=None, csv_path=None, csv_kwargs=None, **fig_kw)[source]

Represent evolution of forward power threshold with \(R\).

Somersalo et al. [SYOPS98] link the mixed wave (\(MW\)) forward power with the traveling wave (\(TW\)) forward power through reflection coefficient \(R\).

\[P_\mathrm{MW} \sim \frac{1}{(1 + R)^2}P_\mathrm{TW}\]

Note

Parameters:
  • thresholds_sets (Mapping[MultipactorTest, ThresholdSet]) – Contains the threshold to represent.

  • show_fit (bool, default: True) – To perform a fit and plot it.

  • use_theoretical_r (bool, default: False) – Allows fitting and plotting using the theoretical reflection coefficient instead of the one calculated from \(P_f\) and \(P_r\).

  • axes (Axes | None, default: None) – Axes to plot if provided.

  • png_path (Path | None, default: None) – If provided, the resulting figure will be saved at this location.

  • png_kwargs (dict | None, default: None) – Other keyword arguments passed to the save_figure() function.

  • csv_path (Path | None, default: None) – If provided, the data to produce the figure will be saved in this location.

  • csv_kwargs (dict | None, default: None) – Other keyword arguments passed to the save_dataframe() function.

  • fig_kw – Other keyword arguments passed to Figure.

  • full_output (bool, default: True)

  • add_upper_thresholds (bool, default: False)

Return type:

tuple[Axes | None, dict[float, DataFrame] | None, dict[float, DataFrame] | None, dict[float, DataFrame | None] | None]

Returns:

  • axes – Holds the plot.

  • df_low – Holds forward power at every lower threshold, by RF frequency.

  • df_upp – Holds forward power at every upper threshold, by RF frequency.

  • df_fit – Holds forward power at every lower threshold, as fitted on df_low, for the different RF frequencies.

check_perez_scaling_law(thresholds_sets, xdata, use_theoretical_xdata=False, add_upper_thresholds=False, axes_by_freq=None, png_path=None, png_kwargs=None, csv_path=None, csv_kwargs=None, ms=15, low_marker='o', high_marker='*', **fig_kw)[source]

Represent evolution of voltage threshold with \(R\) or \(SWR\).

Perez et al. [PTV+09] studied evolution of thresholds, expressed as voltage, with the propagation mode. They concluded that, for low values of frequency-gap product (\(fd < 7~\mathrm{GHz\cdot mm}\)), voltage thresholds were independent from the propagation mode. When \(fd > 7~\mathrm{GHz\cdot mm}\), SW lower thresholds are higher than TW lower thresholds.

Note

In contrary to the Somersalo scaling law, “local” multipactor thresholds should be given.

Parameters:
  • thresholds_sets (Mapping[MultipactorTest, ThresholdSet]) – Contains the threshold to represent. For every instrument, will plot the last lower and upper thresholds found. In general, you will want to give ThresholdSet corresponding to multipactor detected anywhere in the line (use threshold_reducer = "any" in ThresholdSet.from_instruments()). Additionally, you can also average the last Threshold by giving an AveragedThresholdSet.

  • xdata (ABCMeta) – TODO

  • use_theoretical_xdata (bool, default: False) – TODO

  • add_upper_thresholds (bool, default: False) – To also plot upper thresholds.

  • axes_by_freq (dict[float, Axes | None] | None, default: None) – Axes to re-use.

  • png_path (Path | None, default: None) – If provided, the resulting figure will be saved at this location.

  • png_kwargs (dict | None, default: None) – Other keyword arguments passed to the save_figure() function.

  • csv_path (Path | None, default: None) – If provided, the data to produce the figure will be saved in this location.

  • csv_kwargs (dict | None, default: None) – Other keyword arguments passed to the save_dataframe() function.

  • fig_kw – Other keyword arguments passed to Figure.

  • ms (float, default: 15)

  • low_marker (str, default: 'o')

  • high_marker (str, default: '*')

Return type:

tuple[dict[float, Axes] | None, dict[float, DataFrame]]

Returns:

  • axes – Holds the plot.

  • thresholds_by_freq – Plotted thresholds, by freq.

susceptibility_chart(thresholds_sets, ydata=<class 'abc.ABCMeta'>, d_cm=None, fd_col='$f\\\\cdot d~[\\\\mathrm{MHz~cm}]$', xlim=None, ylim=None, color_according_to_swr=True, png_path=None, png_kwargs=None, csv_path=None, csv_kwargs=None, fig_kwargs=None, **kwargs)[source]

Create a susceptibility chart.

Parameters:
  • thresholds_sets (Mapping[MultipactorTest, ThresholdSet]) – Object holding where multipactor happens for every test.

  • ydata (ABCMeta, default: <class 'abc.ABCMeta'>) – Type of instrument of which you want data in y-axis. In general, you will want FieldProbe or ForwardPower.

  • keep_only_travelling – To remove points where \(SWR\) is not unity.

  • d_cm (float | None, default: None) – System gap in \(\mathrm{cm}\).

  • fd_col (str, default: '$f\\\\cdot d~[\\\\mathrm{MHz~cm}]$') – The xlabel for the plot. The default is good enough.

  • xlim (tuple[float, float] | None, default: None) – Plot limits.

  • ylim (tuple[float, float] | None, default: None) – Plot limits.

  • color_according_to_swr (bool, default: True) – If True, the markers colors follow the value of the SWR.

  • png_path (Path | None, default: None) – If provided, the resulting figure will be saved at this location.

  • png_kwargs (dict | None, default: None) – Other keyword arguments passed to the save_figure() function.

  • csv_path (Path | None, default: None) – If provided, the data to produce the figure will be saved in this location.

  • csv_kwargs (dict | None, default: None) – Other keyword arguments passed to the save_dataframe() function.

  • fig_kwargs (dict | None, default: None) – Other keyword arguments passed to the pandas.DataFrame.plot() method.

  • kwargs

Return type:

tuple[Axes, DataFrame]

Returns:

  • axes – Plotted axes.

  • data – Corresponding data.

animate_instruments_vs_position(*args, out_folder=None, iternum=100, **kwargs)[source]

Call all MultipactorTest.animate_instruments_vs_position()

Parameters:
  • out_folder (str | None, default: None)

  • iternum (int, default: 100)

Return type:

list[FuncAnimation]

scatter_instruments_data(*args, out_folder=None, iternum=200, **kwargs)[source]

Call all MultipactorTest.scatter_instruments_data().

Parameters:
  • out_folder (str | None, default: None)

  • iternum (int, default: 200)

Return type:

None

append(object, /)

Append object to the end of the list.

clear()

Remove all items from list.

copy()

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

insert(index, object, /)

Insert object before index.

pop(index=-1, /)

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

remove(value, /)

Remove first occurrence of value.

Raises ValueError if the value is not present.

reverse()

Reverse IN PLACE.

sort(*, key=None, reverse=False)

Sort the list in ascending order and return None.

The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).

If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.

The reverse flag can be set to sort in descending order.