A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
two-ray-to-three-gpp-ch-calibration Namespace Reference

Classes

class  FtrParams
 FtrParams class. More...
 

Functions

str append_ftr_params_to_cpp_string (str text, FtrParams params)
 
float compute_anderson_darling_measure (list ref_ecdf, list target_ecdf)
 Computes the Anderson-Darling measure for the specified reference and targets distributions.
 
np.ndarray compute_ecdf_value (list ecdf, float data_points)
 Given an ECDF and data points belonging to its domain, returns their associated EDCF value.
 
def compute_ftr_mean (FtrParams params)
 Computes the mean of the FTR fading model, given a specific set of parameters.
 
def compute_ftr_th_mean (FtrParams params)
 Computes the mean of the FTR fading model using the formula reported in the corresponding paper, given a specific set of parameters.
 
str fit_ftr_to_reference (pd.DataFrame ref_data, tuple ref_params_combo, int num_params, int num_refinements)
 Estimate the FTR parameters yielding the closest ECDF to the reference one.
 
def get_ftr_ecdf (FtrParams params, int n_samples, db=False)
 Returns the ECDF for the FTR fading model, for a given parameter grid.
 
float get_sigma_from_k (float k)
 Computes the value for the FTR parameter sigma, given k, yielding a unit-mean fading process.
 
def print_cplusplus_map_from_fit_results (pd.DataFrame fit, str out_fname)
 
def tqdm_joblib (tqdm_object)
 

Variables

float ad_meas
 
list ad_measures = []
 
argp args = parser.parse_args()
 
np avg_mean = np.mean(mean_list)
 
 bbox_inches
 
argp c_plus_plus_out_fname = args.c_plus_plus_out_fname
 
 data
 
str data_query = 'scen == @params_comb[0] and cond == @params_comb[1] and fc == @params_comb[2]'
 
 default
 
 delta
 
pd df = pd.read_csv(ref_data_fname, sep='\t')
 Data pre-processing ##.
 
 dpi
 
float epsilon = float(args.epsilon)
 
 exist_ok
 
open f = open(fit_out_fname, "w")
 
argp figs_folder = args.figs_folder
 
pd fit = pd.read_csv(fit_out_fname, delimiter='\t')
 
bool fit_ftr_to_threegpp = bool(args.fit_ftr_to_threegpp)
 
pd fit_line = fit.query(data_query)
 
argp fit_out_fname = args.fit_out_fname
 
np frequencies = np.sort(list(set(df['fc'])))
 
def ftr_ecdf = get_ftr_ecdf(params, len(ref_data), db=True)
 
 help
 
set is_los = set(df['cond'])
 
 k
 
 label
 
 m
 
list mean_list = []
 
list mean_th_list = []
 
 num
 
int num_refinements = int(args.num_refinements)
 
int num_search_grid_params = int(args.num_search_grid_params)
 
bool output_ns3_table = bool(args.output_ns3_table)
 
FtrParams params = FtrParams()
 Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
 
 parents
 
argp parser = argp.ArgumentParser(formatter_class=argp.ArgumentDefaultsHelpFormatter)
 
bool plot_fit_results = bool(args.plot_fit_results)
 
bool preliminary_fit_test = bool(args.preliminary_fit_test)
 
 rc
 
pd ref_data = df.query(data_query)
 
argp ref_data_fname = args.ref_data_fname
 
joblib res
 
set scenarios = set(df['scen'])
 
float sigma = get_sigma_from_k(k)
 
 start
 
 stop
 
 True
 
 x
 

Function Documentation

◆ append_ftr_params_to_cpp_string()

str two-ray-to-three-gpp-ch-calibration.append_ftr_params_to_cpp_string ( str  text,
FtrParams  params 
)

Definition at line 383 of file two-ray-to-three-gpp-ch-calibration.py.

Referenced by print_cplusplus_map_from_fit_results().

+ Here is the caller graph for this function:

◆ compute_anderson_darling_measure()

float two-ray-to-three-gpp-ch-calibration.compute_anderson_darling_measure ( list  ref_ecdf,
list  target_ecdf 
)

Computes the Anderson-Darling measure for the specified reference and targets distributions.

In particular, the Anderson-Darling measure is defined as: A^2 = -N -S, where S = \sum_{i=1}^N \frac{2i - 1}{N} \left[ ln F(Y_i) + ln F(Y_{N + 1 - i}) \right].

See https://www.itl.nist.gov/div898/handbook/eda/section3/eda35e.htm for further details.

Parameters
ref_ecdfThe reference ECDF.
target_ecdfThe target ECDF we wish to match the reference distribution to.
Returns
The Anderson-Darling measure for the specified reference and targets distributions.

Definition at line 220 of file two-ray-to-three-gpp-ch-calibration.py.

References compute_ecdf_value().

Referenced by fit_ftr_to_reference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compute_ecdf_value()

np.ndarray two-ray-to-three-gpp-ch-calibration.compute_ecdf_value ( list  ecdf,
float  data_points 
)

Given an ECDF and data points belonging to its domain, returns their associated EDCF value.

Parameters
ecdfThe ECDF, represented as a sorted list of samples.
data_pointA list of data points belonging to the same domain as the samples.
Returns
The ECDF value of the domain points of the specified ECDF

Definition at line 248 of file two-ray-to-three-gpp-ch-calibration.py.

Referenced by compute_anderson_darling_measure().

+ Here is the caller graph for this function:

◆ compute_ftr_mean()

def two-ray-to-three-gpp-ch-calibration.compute_ftr_mean ( FtrParams  params)

Computes the mean of the FTR fading model, given a specific set of parameters.

Parameters
paramsThe FTR fading model parameters.

Definition at line 197 of file two-ray-to-three-gpp-ch-calibration.py.

◆ compute_ftr_th_mean()

def two-ray-to-three-gpp-ch-calibration.compute_ftr_th_mean ( FtrParams  params)

Computes the mean of the FTR fading model using the formula reported in the corresponding paper, given a specific set of parameters.

Parameters
paramsThe FTR fading model parameters.

Definition at line 211 of file two-ray-to-three-gpp-ch-calibration.py.

◆ fit_ftr_to_reference()

str two-ray-to-three-gpp-ch-calibration.fit_ftr_to_reference ( pd.DataFrame  ref_data,
tuple  ref_params_combo,
int  num_params,
int  num_refinements 
)

Estimate the FTR parameters yielding the closest ECDF to the reference one.

    Uses a global search to estimate the FTR parameters yielding the best fit to the reference ECDF.
    Then, the search is refined by repeating the procedure in the neighborhood of the parameters
    identified with the global search. Such a neighborhood is determined as the interval whose center
    is the previous iteration best value, and the lower and upper bounds are the first lower and upper
    values which were previously considered, respectively.

  @param ref_data: The reference data, represented as a DataFrame of samples.
  @param ref_params_combo: The specific combination of simulation parameters corresponding
                           to the reference ECDF
  @param num_params: The number of values of each parameter in the global and local search grids.
  @param num_refinements: The number of local refinement search to be carried out after the global search.

  @returns An estimate of the FTR parameters yielding the closest ECDF to the reference one.

Definition at line 273 of file two-ray-to-three-gpp-ch-calibration.py.

References compute_anderson_darling_measure(), get_ftr_ecdf(), get_sigma_from_k(), max, and min.

+ Here is the call graph for this function:

◆ get_ftr_ecdf()

def two-ray-to-three-gpp-ch-calibration.get_ftr_ecdf ( FtrParams  params,
int  n_samples,
  db = False 
)

Returns the ECDF for the FTR fading model, for a given parameter grid.

Parameters
paramsThe FTR parameters grid.
n_samplesThe number of samples of the output ECDF
dbWhether to return the ECDF with the gain expressed in dB
Returns
The ECDF for the FTR fading model

Definition at line 149 of file two-ray-to-three-gpp-ch-calibration.py.

Referenced by fit_ftr_to_reference().

+ Here is the caller graph for this function:

◆ get_sigma_from_k()

float two-ray-to-three-gpp-ch-calibration.get_sigma_from_k ( float  k)

Computes the value for the FTR parameter sigma, given k, yielding a unit-mean fading process.

Parameters
kThe K parameter of the FTR fading model, which represents the ratio of the average power of the dominant components to the power of the remaining diffuse multipath.
Returns
The value for the FTR parameter sigma, given k, yielding a unit-mean fading process.

Definition at line 263 of file two-ray-to-three-gpp-ch-calibration.py.

Referenced by fit_ftr_to_reference().

+ Here is the caller graph for this function:

◆ print_cplusplus_map_from_fit_results()

def two-ray-to-three-gpp-ch-calibration.print_cplusplus_map_from_fit_results ( pd.DataFrame  fit,
str  out_fname 
)
Prints to a file the results of the FTR fit, as C++ code.

Args:
  fit (pd.DataFrame): A Pandas Dataframe holding the results of the FTR fit.
  out_fname (str): The name of the file to print the C++ code to.

Definition at line 390 of file two-ray-to-three-gpp-ch-calibration.py.

References append_ftr_params_to_cpp_string(), and list.

+ Here is the call graph for this function:

◆ tqdm_joblib()

def two-ray-to-three-gpp-ch-calibration.tqdm_joblib (   tqdm_object)
  Context manager to patch joblib to report into tqdm progress bar given as argument.
  Taken from: https://stackoverflow.com/questions/24983493/tracking-progress-of-joblib-parallel-execution

Definition at line 85 of file two-ray-to-three-gpp-ch-calibration.py.

Variable Documentation

◆ ad_meas

float two-ray-to-three-gpp-ch-calibration.ad_meas
Initial value:
1= compute_anderson_darling_measure(
2 np.sort(ref_data['gain']), ftr_ecdf)

Definition at line 549 of file two-ray-to-three-gpp-ch-calibration.py.

◆ ad_measures

two-ray-to-three-gpp-ch-calibration.ad_measures = []

Definition at line 527 of file two-ray-to-three-gpp-ch-calibration.py.

◆ args

argp two-ray-to-three-gpp-ch-calibration.args = parser.parse_args()

Definition at line 59 of file two-ray-to-three-gpp-ch-calibration.py.

◆ avg_mean

np two-ray-to-three-gpp-ch-calibration.avg_mean = np.mean(mean_list)

Definition at line 478 of file two-ray-to-three-gpp-ch-calibration.py.

◆ bbox_inches

two-ray-to-three-gpp-ch-calibration.bbox_inches

Definition at line 561 of file two-ray-to-three-gpp-ch-calibration.py.

◆ c_plus_plus_out_fname

argp two-ray-to-three-gpp-ch-calibration.c_plus_plus_out_fname = args.c_plus_plus_out_fname

Definition at line 69 of file two-ray-to-three-gpp-ch-calibration.py.

◆ data

two-ray-to-three-gpp-ch-calibration.data

Definition at line 553 of file two-ray-to-three-gpp-ch-calibration.py.

◆ data_query

str two-ray-to-three-gpp-ch-calibration.data_query = 'scen == @params_comb[0] and cond == @params_comb[1] and fc == @params_comb[2]'

Definition at line 531 of file two-ray-to-three-gpp-ch-calibration.py.

◆ default

two-ray-to-three-gpp-ch-calibration.default

Definition at line 36 of file two-ray-to-three-gpp-ch-calibration.py.

◆ delta

two-ray-to-three-gpp-ch-calibration.delta

Definition at line 475 of file two-ray-to-three-gpp-ch-calibration.py.

◆ df

pd two-ray-to-three-gpp-ch-calibration.df = pd.read_csv(ref_data_fname, sep='\t')

Data pre-processing ##.

Definition at line 453 of file two-ray-to-three-gpp-ch-calibration.py.

◆ dpi

two-ray-to-three-gpp-ch-calibration.dpi

Definition at line 561 of file two-ray-to-three-gpp-ch-calibration.py.

◆ epsilon

float two-ray-to-three-gpp-ch-calibration.epsilon = float(args.epsilon)

Definition at line 73 of file two-ray-to-three-gpp-ch-calibration.py.

◆ exist_ok

two-ray-to-three-gpp-ch-calibration.exist_ok

Definition at line 526 of file two-ray-to-three-gpp-ch-calibration.py.

◆ f

open two-ray-to-three-gpp-ch-calibration.f = open(fit_out_fname, "w")

Definition at line 502 of file two-ray-to-three-gpp-ch-calibration.py.

◆ figs_folder

argp two-ray-to-three-gpp-ch-calibration.figs_folder = args.figs_folder

Definition at line 71 of file two-ray-to-three-gpp-ch-calibration.py.

◆ fit

pd two-ray-to-three-gpp-ch-calibration.fit = pd.read_csv(fit_out_fname, delimiter='\t')

Definition at line 512 of file two-ray-to-three-gpp-ch-calibration.py.

◆ fit_ftr_to_threegpp

bool two-ray-to-three-gpp-ch-calibration.fit_ftr_to_threegpp = bool(args.fit_ftr_to_threegpp)

Definition at line 77 of file two-ray-to-three-gpp-ch-calibration.py.

◆ fit_line

pd two-ray-to-three-gpp-ch-calibration.fit_line = fit.query(data_query)

Definition at line 537 of file two-ray-to-three-gpp-ch-calibration.py.

◆ fit_out_fname

argp two-ray-to-three-gpp-ch-calibration.fit_out_fname = args.fit_out_fname

Definition at line 67 of file two-ray-to-three-gpp-ch-calibration.py.

◆ frequencies

np two-ray-to-three-gpp-ch-calibration.frequencies = np.sort(list(set(df['fc'])))

Definition at line 460 of file two-ray-to-three-gpp-ch-calibration.py.

◆ ftr_ecdf

two-ray-to-three-gpp-ch-calibration.ftr_ecdf = get_ftr_ecdf(params, len(ref_data), db=True)

Definition at line 546 of file two-ray-to-three-gpp-ch-calibration.py.

◆ help

two-ray-to-three-gpp-ch-calibration.help

Definition at line 37 of file two-ray-to-three-gpp-ch-calibration.py.

◆ is_los

set two-ray-to-three-gpp-ch-calibration.is_los = set(df['cond'])

Definition at line 459 of file two-ray-to-three-gpp-ch-calibration.py.

◆ k

two-ray-to-three-gpp-ch-calibration.k

Definition at line 488 of file two-ray-to-three-gpp-ch-calibration.py.

◆ label

two-ray-to-three-gpp-ch-calibration.label

Definition at line 554 of file two-ray-to-three-gpp-ch-calibration.py.

◆ m

two-ray-to-three-gpp-ch-calibration.m

Definition at line 540 of file two-ray-to-three-gpp-ch-calibration.py.

◆ mean_list

list two-ray-to-three-gpp-ch-calibration.mean_list = []

Definition at line 472 of file two-ray-to-three-gpp-ch-calibration.py.

◆ mean_th_list

list two-ray-to-three-gpp-ch-calibration.mean_th_list = []

Definition at line 483 of file two-ray-to-three-gpp-ch-calibration.py.

◆ num

two-ray-to-three-gpp-ch-calibration.num

Definition at line 474 of file two-ray-to-three-gpp-ch-calibration.py.

◆ num_refinements

int two-ray-to-three-gpp-ch-calibration.num_refinements = int(args.num_refinements)

Definition at line 63 of file two-ray-to-three-gpp-ch-calibration.py.

◆ num_search_grid_params

int two-ray-to-three-gpp-ch-calibration.num_search_grid_params = int(args.num_search_grid_params)

Definition at line 61 of file two-ray-to-three-gpp-ch-calibration.py.

◆ output_ns3_table

bool two-ray-to-three-gpp-ch-calibration.output_ns3_table = bool(args.output_ns3_table)

Definition at line 79 of file two-ray-to-three-gpp-ch-calibration.py.

◆ params

FtrParams two-ray-to-three-gpp-ch-calibration.params = FtrParams()

Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.

Definition at line 468 of file two-ray-to-three-gpp-ch-calibration.py.

◆ parents

two-ray-to-three-gpp-ch-calibration.parents

Definition at line 526 of file two-ray-to-three-gpp-ch-calibration.py.

◆ parser

argp two-ray-to-three-gpp-ch-calibration.parser = argp.ArgumentParser(formatter_class=argp.ArgumentDefaultsHelpFormatter)

Definition at line 35 of file two-ray-to-three-gpp-ch-calibration.py.

◆ plot_fit_results

bool two-ray-to-three-gpp-ch-calibration.plot_fit_results = bool(args.plot_fit_results)

Definition at line 81 of file two-ray-to-three-gpp-ch-calibration.py.

◆ preliminary_fit_test

bool two-ray-to-three-gpp-ch-calibration.preliminary_fit_test = bool(args.preliminary_fit_test)

Definition at line 75 of file two-ray-to-three-gpp-ch-calibration.py.

◆ rc

two-ray-to-three-gpp-ch-calibration.rc

Definition at line 520 of file two-ray-to-three-gpp-ch-calibration.py.

◆ ref_data

two-ray-to-three-gpp-ch-calibration.ref_data = df.query(data_query)

Definition at line 534 of file two-ray-to-three-gpp-ch-calibration.py.

◆ ref_data_fname

argp two-ray-to-three-gpp-ch-calibration.ref_data_fname = args.ref_data_fname

Definition at line 65 of file two-ray-to-three-gpp-ch-calibration.py.

◆ res

joblib two-ray-to-three-gpp-ch-calibration.res
Initial value:
1= joblib.Parallel(n_jobs=10)(
2 joblib.delayed(fit_ftr_to_reference)(df, params_comb, num_search_grid_params, num_refinements) for params_comb in product(scenarios, is_los, frequencies))

Definition at line 499 of file two-ray-to-three-gpp-ch-calibration.py.

◆ scenarios

set two-ray-to-three-gpp-ch-calibration.scenarios = set(df['scen'])

Definition at line 458 of file two-ray-to-three-gpp-ch-calibration.py.

◆ sigma

two-ray-to-three-gpp-ch-calibration.sigma = get_sigma_from_k(k)

Definition at line 486 of file two-ray-to-three-gpp-ch-calibration.py.

◆ start

two-ray-to-three-gpp-ch-calibration.start

Definition at line 474 of file two-ray-to-three-gpp-ch-calibration.py.

◆ stop

two-ray-to-three-gpp-ch-calibration.stop

Definition at line 474 of file two-ray-to-three-gpp-ch-calibration.py.

◆ True

two-ray-to-three-gpp-ch-calibration.True

Definition at line 526 of file two-ray-to-three-gpp-ch-calibration.py.

◆ x

two-ray-to-three-gpp-ch-calibration.x

Definition at line 553 of file two-ray-to-three-gpp-ch-calibration.py.