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
MultipactorTestandTestCampaign.- Parameters:
filepaths (
Sequence[Path]) – Filepaths to the LabViewer files.frequencies (
Sequence[float]) – Frequencies 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 toTrue, 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.
- determine_thresholds(multipac_detector, instrument_class, power_growth_array_kw=None, threshold_reducer=None, threshold_predicate=None, instrument_predicate=None, **kwargs)[source]
Determine every
MultipactorTestmultipactor thresholds.- Parameters:
multipac_detector (
Callable[[ndarray[tuple[Any,...],dtype[double]]],ndarray[tuple[Any,...],dtype[bool]]]) – Function that takes in thedataof anInstrumentand returns an array, where True means multipactor and False no multipactor.instrument_class (
ABCMeta) – Type of instrument on whichmultipac_detectorshould be applied.power_growth_array_kw (
dict[str,Any] |None, default:None) – Keyword arguments passed toPowerSetpoint.growth_array().threshold_reducer (
Literal['any','all'] |None, default:None) – If provided, we consider that multipactor appears when one detectingInstrumentdetected it ("any"), or only when all detectingInstrumentmeasured it ("all").threshold_predicate (
ThresholdFilter|None, default:None) – Function filtering the thresholds. Applied afterthreshold_reducer.instrument_predicate (
Callable[[ABCMeta|Instrument|str],bool] |None, default:None) –Instrumentfiltering function.
- Return type:
- Returns:
Objects holding all lower and upper thresholds, detected by
multipac_detectorapplied on every instance ofinstrument_classfor everyMultipactorTest.
- reconstruct_voltage_along_line(*args, **kwargs)[source]
Call all
MultipactorTest.reconstruct_voltage_along_line().- Return type:
- 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:
args – Arguments that are passed to
MultipactorTest.sweet_plot().thresholds_sets (
dict[MultipactorTest,ThresholdSet] |None, default:None) – Thresholds to plot corresponding to some or eachMultipactorTest.png_folder (
str|None, default:None) – If provided, all the created figures will be saved there.csv_folder (
str|None, default:None) – If provided, all the created DataFrame will be saved there.all_on_same_plot (
bool, default:False) – If all the data from all theMultipactorTestshould be drawn on the same Axes.kwargs – Other keyword arguments passed to
MultipactorTest.sweet_plot().
- 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:
args – Arguments that are passed to
MultipactorTest.sweet_plot().thresholds_sets (
dict[MultipactorTest,ThresholdSet] |None, default:None) – Thresholds to plot corresponding to some or eachMultipactorTest.png_folder (
Path|None, default:None) – If provided, all the created figures will be saved there.csv_folder (
Path|None, default:None) – If provided, all the created DataFrame will be saved there.all_on_same_plot – If all the data from all the
MultipactorTestshould be drawn on the same Axes.kwargs – Other keyword arguments passed to
MultipactorTest.sweet_plot().
- Return type:
- 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:
- 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
MultipactorTestinself.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:
- 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:
ax1 (
Axes)ax2 (
Axes)thresholds_sets (
Mapping[MultipactorTest,ThresholdSet])
- Return type:
- 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
Multipactor is detected on a global level, i.e. multipactor threshold is reached when multipactor is detected anywhere in the system. Such
ThresholdSetcan be created by usingthreshold_reducer = "any"inMultipactorTest.determine_thresholds().
See also
TestCampaign.check_perez_scaling_law(),MultipactorTest.determine_thresholds(),AveragedThresholdSet.from_threshold_set()- 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 thesave_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 thesave_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 giveThresholdSetcorresponding to multipactor detected anywhere in the line (usethreshold_reducer = "any"inThresholdSet.from_instruments()). Additionally, you can also average the lastThresholdby giving anAveragedThresholdSet.xdata (
ABCMeta) – TODOuse_theoretical_xdata (
bool, default:False) – TODOadd_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 thesave_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 thesave_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:
- 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 wantFieldProbeorForwardPower.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 thesave_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 thesave_dataframe()function.fig_kwargs (
dict|None, default:None) – Other keyword arguments passed to thepandas.DataFrame.plot()method.kwargs
- Return type:
- 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:
- Return type:
- 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.