 Initializates the dataframe with the basic params that all csv files should have
            to compute some calculated parameters. If some of them do not exist in the dataframe yet,
            they are created with NaN values.


 Most of NaN columns should be removed in "manage_empty_cols"
            This is just for the 'required' columns which are empty


 it creates the self.df dataframe object
            taking into account if data.csv is created or not


 create the self.moves dataframe object
            taking into account if moves.csv is already created or not


 Create a column id for the whp-exchange files
            this new column is a hash of these fields combined:
                * STNNBR     station number
                * CASTNO     cast number (it may exist or not)
                * BTLNBR     bottle number (it may exist or not)
                * LATITUDE   latitude
                * LONGITUDE  longitude


 Converts the DF from string to numeric values
            downcasting the resulting data to the smallest numerical dtype possible (int8 is the minimum)

            If the column has float values, all the column will have
            the same number of decimals (the maximum, zero in the right side is not taking into account)

            If a cell of a column with dtype=np.int8 is assigned to some int64 value, then the column
            is completely converted to int64


 Set the precision of all the columns in self.cols['precision']
                * get the columns with float values > precision = X
                * get the columns with int values   > precision = 0
                * get the columns with str values   > precision = False


 This method is executed mainly when a flag is pressed to update the values
                * column: it is the column to update, only one column
                * new_flag_value: it is the flag value


 Compute all the calculated parameters again. Mainly after a cruise data update

            NOTE: what should happen if some column cannot be computed?
                  - Check if it is plotted in order to remove the plots?
                  - Show a error message (now only a warning appears)


Creates dummy objects to trigger and send messages between electron and bokeh


 Build the response to send back to JavaScript

            @message = {
                'object': '',
                'method': '',
                'args': {}
            }


 General method to run JavaScript inside the iframe
            The signal is sent to the bokeh_renderer.js file
            TODO: they are developing a better way to run JavaScript directly


 General method to run JavaScript code from python
            The signal is sent to the main_renderer.js file
            and calls the 'js_call' method in the tools.js file


The Process ID is saved in the shared_data.json file


 Checks data type and instantiates the appropriate cruise data object
                `whp` and `raw_csv` (csv) >> process file from scratch and validate data
                `aqc` >> open directly
                @update - boolean, whether the instantiated object is to make comparisons or not


The original.csv file should be a normal raw csv file


Open the file and checks if comply to the WHP format requirements


 Load tabs from setting.json file. A structure like this:

                "qc_plot_tabs": {
                    "NITRAT": [
                        {
                            "title": "Nitrate vs Phosphate",
                            "x": "NITRAT",
                            "y": "PHSPHT"
                        },
                        {
                            "title": "Nitrate vs OXYGEN",
                            "x": "NITRAT",
                            "y": "OXYGEN"
                        }
                    ],
                    "PH_TOT": [
                        {
                            "title": "pH vs Nitrate",
                            "x": "PH_TOT",
                            "y": "NITRAT"
                        }
                    ]
                },


 Checks if the columns that are in the plot layout
            and removes them if needed


Load some settings into object attributes


 Adds a hash to the end of the url resources if `with_hash`
            function is used in the template


 Create an export_whp.csv file to export it with node
            it has to be removed by node once it is saved by the user
            It will export the latest saved data


 Create an export_data.csv file to export it with node
            It will export the latest saved data


 it saves the dataframe self.df to the data.csv file
            the columns x_wm and y_wm are not saved because they are
            automatically generated from LATITUDE and LONGITUDE columns


 It adds the computed parameter to cols and to the project.
            Previous to this method we had to check the dependencies and
            that all the columns needed are in the current dataframe


This function is run for each found ocurrence


 Return a list of identifiers used by the equation
            The parameters ${} should already be replaced before
            Pure numbers are deleted from the list


 If the CP can be computed then the dependencies are satisfied
            Maybe it is a good idea to avoid the eval method for efficiency?

            This is used when the form 'add_computed_parameter_expression' is loaded

            @return = {
                'cp_param_1': True,                 # dependencies satisfied
                'cp_param_2': False,                 # dependencies don't satisfied
            }


 Delete the value passed in the argument:
            args = {
                'value': 'example_column',
            }


 Checks if all the rows have the same number of elements

            In this case there is no need to check the data because
            was already checked when it was open the first time


 Adds all the calculated parameters to the DF when the file is loaded in the application.
            The computed parameters from the columns.json should be computed.

            NOTE: When the file is open the cps are copied from `custom_settings.json`
                  So we have all the CP we need in cps['proj_settings_cps']
                  Also the computed parameters in self.cols is always going to be a subset of the proj_settings_cps


Checks if all the rows have the same number of elements


 Adds all the calculated parameters to the DF
            when the file is loaded in the application.

                NOTE: When the file is open the cps are copied from `custom_settings.json`
                      So we have all the CP we need in cps['proj_settings_cps']


 NO2_NO3 is the sum of NITRAT and NITRIT, sometimes both are reported separately.
            Some other times we need to get the NITRATE from the difference NO2_NO3 - NITRIT.
            NO2_NO3 exists because there are some devices that take the measures together.
            The values of NITRIT are always tiny. If the column does not exist we can do NITRATE = NO2_NO3.


 @msg - the beginning of the message that is shown in the actions history
            @col1 - the first column name to combine, more precise than the second
            @col1 - the second column name to combine


 compare the new original.csv with the old one
            the results are showed to the user
            in order to ask for the confirmation


 Compare columns
            Required columns will always exist
            Computed columns are not taken in consideration

             # compare a computed param only if the self.cruise_data.df column is a param column


 Comparison of values between both DF
            If there are removed rows or columns the values comparison is not possible
            So I need the intersections of rows and columns to make sure that they exist in both df


aux folder is removed file is removed


 Update and save columns, rows and values from the new data object self.env.cd_aux created
            from an updated WHP csv file. The changes accepted by the user are updated to the old_data object

            The parameters sent (params dictionary) are boolean values, for example if everything should be saved:
            params = {
                'add_cols': true,
                'rmv_cols': true,
                'add_rows': true,
                'rmv_rows': true,
                'diff_val_qty': true,
                'diff_values': {}     # dict with the accepted values
            }


 It updates the old_data object adding or removing columns
            that are in the new object (self.env.cd_aux)


 update the values in the self.env.cruise_data object with the new ones
            the flag associated to the columns has to be reset


The log of actions is updated with the new operations


 Plot different circles depending on their flag
            All the flags should be plotted in all the plots,
            even if they do not have the right flag (self.env.all_flags)


 This is just a initialization of the Line GlyphRenderers.

            If some selected point are on the same profile, only one should be drawn

            Note: the line profiles cannot be plotted with CDSViews because if the indexes are
                  not consecutive then the line is not going to be only one line.


 This method renders the profile line vertexes (circles).
            Two glyphs are plotted:
                * Selected points
                * Non-selected points


 The asterisk is the mark for the current selected sample
                * self.asterisk - red asterisk on the background
                * self.aux_asterisk_asterisk - marked asterisk
                * self.aux_asteris_circle - center asterisk marked


 This method should be assigned to all the plots to reset the zoom level and location
                * Hides all the Line GlyphRenderers on the plot.
                * The selection is also removed
                * The flag visibility is reset

            NOTE: this is run once per plot in each tab, but actually we need to run it only once


 This could be useful to change the axis variables
            or some other plot attributes on the fly


This tool should be added only once per tab


 Makes visible the flags passed as argument, and make invisible the rest
                @to_visible_flags: all the visible (or to make visible) flags indices


 Create a data matrix with the plot images
            in order to create the final table with reportlab


scales image with given width. fileish may be file or path


 base64_images is a string, the result to convert it in an object:
            INPUT >>

            {
                '0': [
                    "data:image/png;base64,iVBORw0KGgoAAAANSUh .... ",
                    "data:image/png;base64,sdfsdgrgwergweERGWErgWERGwh .... ",
                ]
                '1': ["data:image/png;base64,iVBORw0KGgoAAAANSUh .... "]
            }

            OUTPUT >>

            self.tab_img = {
                'SALNTY': [
                    Platypus Flowable Image,
                    Platypus Flowable Image,
                ]
                'CTMTMP': [Image obj]
            }


            The result should be something like this:

            self.env.views = {
                'TAB_NAME': {
                    0: view_object_0,
                    1: view_object_1,
                }
            }

            NOTE: self.env.all_flags and  self.env.tabs_flags_plots should be created beforehand


 Creates a CDS for the profile points. So the column names:
                NITRAT_SALTNY_5:
                    * NITRAT >> Tab where the plot is drawn
                    * SALTNY >> Column data
                    * 5      >> Station number: (0, 1, 2, 3, 4 or 5) for NPROF = 6


Multiline ColumnDataSource Initialization


 Set all the possible flag values. Generates a dictionary like this:
            self.env.all_flags = {
                2: 'FLAG 2',
                3: 'FLAG 3',
                ...
            }


 Selects the points of the profile line and update the multiline data source
            and asterisks and circles views to draw the whole profiles.
            This method should be the most efficient of the app
                @force_selection: a new partial selection should be done from scratch


 Basically this method make these steps:
                1. Get non-nan values positions to reset just them
                2. Mix these positions with the new values
                3. Reduce the number of slices by groups
                4. Send patch

                NOTE: How to patch NaN values: https://github.com/bokeh/bokeh/issues/7525
                      The indices must be int (Int64 throws error)


 Selects the first NPROF points with different stations
            in order to plot the profile lines
                @return list with non-duplicated stations


 Update profile circle sources. The self.env.pc_src is updated
            in order to mark the selected samples profiles over all the plots.

            @df_fs: DF with data only with the current stations to show
            @stt_order: selected stations, red color at the end of the list


DF initialization with empty values


 Creates a new CDS with the new asterisk source data (selected sample)
            If nothing is selected the CDS is reset.

            NOTE: Be careful with this method because the lists orders is very important
                  and dificult to follow


 This is run when some elements are selected:
                @attr: 'selected'
                @old: >> does not work well yet with the new Selection class?
                @new: >> new_indices store the new selection indices list


 Updates the map selection programmatically with the stations of the selected samples
                @new_indices: list of indices of the selected samples (cds_df)


Plot the profiles with the visible points or with the invisible as well


 Disable previous and next buttons when the station selected in in the limit or
            when the checkbox of showing nearby station is not ticked


 Removes callback when the onchange method in the dropdown is triggeres
            Disable navigation buttons and remove option values in the select widget


Reset the layout values in order to prepare them for the next loading time


 Get the list of plots. More about properties:
            https://docs.python.org/2/library/functions.html#property
            This is a readonly property


 Return the number of plots. More about properties:
            https://docs.python.org/2/library/functions.html#property
            This is a readonly property

            NOTE: self.env.n_plots should be updated and synchronized with this property


 This dictionary is created to store the flag and plots that are located in each tab

            self.env.tabs_flags_plots = {
                'NITRAT': {
                    'flag': 'NITRAT_FLAG_W',       # default flag to mark in the dropdown
                    'plots': [0, 1, 2, 3]          # plot list in order to create the gridplot
                                                   # positions in self.env.bk_plots
                },
                'SALNTY': {
                    'flag': 'SALNTY_FLAG_W',
                    'plots': [4, 5, 6]
                },

                # [...]
            }


Updates the datatable source depending on the selected samples


Updates the datatable with the data of the self.s


    Determine the ordering and breaks in BDY files to aid plotting.

    This function takes the i/j coordinates from BDY files and orders them sequentially
    making it easier to visualise sections along the open boundary. Breaks in the open
    boundary are also determined (i.e. where the distance between two points > 2**0.5)

    Args:
    ----
        fname     (str) : filename of BDY file

    Returns:
    -------
        bdy_ind   (dict): re-ordered indices
        bdy_dst   (dict): distance (in model coords) between points
        bdy_brk   (dict): location of the break points in the open boundary


    Plot 2d section along boundaries.

    Divide data into segments. Then (polgon patch) plot segments in separate panels as a function of depth

    Returns
    -------
        f - figure handle


    Plot 1d section along boundaries.

    Divide data into segments. Then (line) plot segments in separate panels

    Returns
    -------
        f - figure handle


Generate synthetic boundaries as test cases.

    Generates a 2D array based on the selected map type.

    Args:
    ----
        map (int): Map type (1, 2, 3, 4 or 5).

    Returns:
    -------
        numpy.ndarray: Generated 2D array.


    Generate sigma vertical coordinates for gdep.

    This uses the original default NEMO s-coordinate stretching
    [Madec et al., 1996].

    Parameters
    ----------
    bathy (np.array)   : bathymetry for calculating the sigma levels
                         (postive down)
    n_zlevel (int)     : number of z levels required
    theta (int)        : surface control parameter (0<=theta<=20)
    b (int)            : bottom control parameter  (0<=b<=1)

    Returns
    -------
    gdept (np.array)       : sigma depth levels on t levels points
    gdepw (np.array)       : sigma depth levels on w levels points


    Generate zco vertical coordinates for gdep.

    Parameters
    ----------
    max_depth (int)    : maximum depth level
    n_zlevel (int)     : number of z levels required

    Returns
    -------
    gdept (np.array)   : zco depth levels on t levels points
    gdepw (np.array)   : zco depth levels on w levels points


    Salinity (in PSU) at a given depth (in meters).

    Parameters
    ----------
        depth (DataArray or float): Depth in meters (0 to 6000).

    Returns
    -------
        DataArray or float: Salinity in PSU.


        Flat bottom case.

        Parameters
        ----------
        depth: float
            Bottom depth (units: m).

        Returns
        -------
        Dataset.


        Channel with seamount case.

        Produces bathymetry of a channel with a Gaussian seamount in order to
        simulate an idealised test case. Based on Marsaleix et al., 2009
        doi:10.1016/j.ocemod.2009.06.011 Eq. 15.

        Parameters
        ----------
        depth: float
            Bottom depth (units: m).
        stiff: float
            Scale factor for steepness of seamount (units: None)

        Returns
        -------
        Dataset.


    Infer sea mask from bathymetry.

    Parameters
    ----------
    ds: Dataset
        Dataset with Bathymetry variable
    Returns
    -------
    Dataset.


    Add CF attributes to bathymetry and mask variables.

    Parameters
    ----------
    ds: Dataset
        Dataset with bathymetry and mask variables [and rmax].

    Returns
    -------
    Dataset.


    Calculate rmax: measure of steepness.

    This function returns the slope steepness criteria rmax, which is simply
    |H[0] - H[1]| / (H[0] + H[1]).

    Parameters
    ----------
    depth: float
        Bottom depth (units: m).

    Returns
    -------
    rmax: float
        Slope steepness value (units: None)

    Notes
    -----
    This function uses a "conservative approach" and rmax is overestimated.
    rmax at T points is the maximum rmax estimated at any adjacent U/V point.


    Rotation of coordinates.

    Parameters
    ----------
    lon: float
        longitude (units: deg), 2D array-like of size x/y.
    lat: float
        latitude (units: deg), 2D array-like of size x/y.
    origin: tuple
        (lon,lat) (units: deg), point of rotation.
    degrees: float
        angle (units: deg) by which to rotate.

    Returns
    -------
    lon: float
        longitude (units: deg), 2D array-like of size x/y.
    lat: float
        latitude (units: deg), 2D array-like of size x/y.


    Generate coordinates and spacing of a NEMO style grid.

    Parameters
    ----------
    ppe1_m, ppe2_m: float, 1D array-like
        Grid spacing along x/y axis (units: deg).
    jpiglo, jpjglo: int, optional
        Size of x/y dimension.
    ppglam0, ppgphi0: float
        x/y coordinate of first T-point (units: deg).
    chunks: dict, optional
         Chunk sizes along each dimension (e.g., ``{"x": 5, "y": 5}``).
         Requires ``dask`` installed.

    Returns
    -------
    Dataset
        Equivalent of NEMO coordinates file.

    Raises
    ------
    ValueError
        If ``ppe{1,2}_m`` is a vector and ``jp{i,j}glo`` is specified, or viceversa.

    Notes
    -----
    Vectors are loaded into memory. If ``chunks`` is specified, 2D arrays are coerced
    into dask arrays before broadcasting.


    Merge {z,e}3{t,w} with ds_bathy, broadcasting and adding CF attributes.

    {z,e}3{t,w} are coordinates of the returned dataset.


    Infer sea mask from bathymetry.

    Parameters
    ----------
    ds: Dataset
        Dataset with Bathymetry variable

    Returns
    -------
    Dataset.


    Generate a Dataset of T/S/U/V given a NEMO bathy Dataset.

    Parameters
    ----------
    ds_domcfg: Dataset

    Returns
    -------
    Dataset
        Equivalent of NEMO output file.

    Raises
    ------
    ValueError


Find out what type of vertical grid is provided zco, zps or sigma levels (sco).


    Calculate the missing vertical grid variables and add them to grid.

    Parameters
    ----------
            zgr_type (str)      : type of vertical grid (zco, zps or sco)
            grid (dict)         : dictionary of grid data variable
            hgr_type (str)      : horizontal grid type
            e_dict (dict)       : dictionary of e1 and e2 scale factors
            missing (list)      : list of missing variables to calculate

    Returns
    -------
            grid (dict)          : vertical grid data dictionary


    Calculate missing gdepw from gdept.

    Parameters
    ----------
            gdept (np.array)   : mesh variable gdept on t-grid

    Returns
    -------
            dep_out (np.array) : vertical grid mesh data variable


    Calculate missing vertical scale factors e3 from gdep.

    Parameters
    ----------
            gdep_mid (np.array)  : mesh variable on t levels
            gdep_top (np.array)  : mesh variable on w levels
            lev (str)            : grid level type (e3 of t, w, u, v)

    Returns
    -------
            e3 (np.array)    : vertical distance scale factor e3 of lev


    Horizontally interpolate the vertical scale factors e3 and gdep.

    For A-Grids, u, v and f values are set to t and w values.
    For C-Grids, zps or sco verticle coords are used to define u, v, and f.
    For B-Grids, u and v values are set to f values following zps or sco.

    Parameters
    ----------
            t (np.array)       : vertical scale factors e or dep on t points
            w (np.array)       : vertical scale factors e or dep on w points
            zgr_type (str)     : type of vertical grid (zco, zps or sco)
            hgr_type (str)     : horizontal grid type (A, B or C)

    Returns
    -------
            lev (dict)            : vertical distance scale factor e or gdep


    Horizontally interpolate the vertical scale factors e3u, e3v, e3f.

    Use the horizontal scale factors to calculate interpolation factors.
    To interpolate to get e3u or e3v, input var_in as e3t data but for e3f this
    should be e3u.

    Parameters
    ----------
            e_in (dict)       : all horizontal scale factors e1 and e2 in dictionary
            var_in (np.array) : e scale factor to interpolate from e3t (or e3u for f)
            lev (str)         : grid level type (e3 of u, v, f)

    Returns
    -------
            e3 (np.array)    : vertical distance scale factor e3 of lev


Find out what type of hoizontal grid is provided A, B or C.


    Calculate the missing horizontal grid variables and add them to grid.

    Parameters
    ----------
            grid_type (str)     : type of horizontal grid (A, B or C)
            grid (dict)         : dictionary of grid data variable
            missing (list)      : list of missing variables to calculate

    Returns
    -------
            grid (dict)          : horizontal grid data dictionary


    Calculate missing glam, gphi or gdep from t-grid.

    Parameters
    ----------
            t_mesh (np.array)  : mesh variable glam or gphi on t-grid
            mesh (str)         : grid mesh type (glam, gphi, or gdep of u, v, f)

    Returns
    -------
            mesh_out (dict)     : horizontal grid mesh data variable


    Calculate missing scale factor e1 and e2 from glam or gphi.

    Parameters
    ----------
            glam (np.array)  : mesh variable glam (lon) [time, j, i]
            gphi (np.array)  : mesh variable gphi (lat) [time, j, i]
            ij (int)         : ij direction 1 (i or x direction) or 2 (j or y direction)

    Returns
    -------
            e (np.array)     : horizontal distance scale factor e


Create dims and returns a dictionary of them.


Set up a grid dictionary.


Create a var w/ attributes.


Populate the file with indices, lat, lon, and e dimensions.


    Start a Qt application.

    Notes
    -----
    This method gives the user the option to pick a namelist.bdy file to edit.
    Once user selects it it will open a dialog box where users can edit the parameters.


    Start the settings window using the setup settings provided in the input.

    Notes
    -----
    On clicking the cancel button it doesn't shutdown the applicaiton but carries on with the execution.


    Command line execution method.

    Checks the input arguments and passes on to method to open the settings window.


    Command line execution method.

    Notes
    -----
    Checks the input arguments and passes on to method to open the ncml generator window.


    Check if source domain wraps and dst spans the wrap.

    Parameters
    ----------
    imin (int) : minimum i index
    imax (int) : maximum i index
    sc_lon (np.array)  : the longitude of the source grid

    Returns
    -------
    wrap_flag (bool) :  if true the sc wraps and dst spans wrap


    Fill the data horizontally then downwards to remove nans before interpolation.

    Parameters
    ----------
    sc_bdy (np.array)   : souce data [nz_sc, nbdy, 9]
    isslab (bool)       : if true data has vertical cells for vertical flood fill
    logger              : log of statements

    Returns
    -------
    sc_bdy (np.array)   : souce data [nz_sc, nbdy, 9]


    Interpolate source data onto destination vertical levels.

    Parameters
    ----------
    sc_bdy (np.array)   : souce data [nz_sc, nbdy, 9]
    dst_dep (np.array)  : the depth of the destination grid chunk [nz, nbdy]
    bdy_bathy (np.array): the destination grid bdy points bathymetry
    z_ind (np.array)    : the indices of the sc depth above and below bdy
    z_dist (np.array)   : the distance weights of the selected points
    num_bdy (int)       : number of boundary points in chunk
    zinterp (bool)      : vertical interpolation flag

    Returns
    -------
    data_out (np.array) : source data on destination depth levels


    Find the distance weightings for averaging source data to destination.

    Parameters
    ----------
        sc_bdy (numpy.array)    : source data
        dist_tot (numpy.array)  : distance from dst point to 9 nearest sc points
        sc_z_len (int)          : the number of depth levels
        r0 (float)              : correlation distance
        logger                  : log of statements

    Returns
    -------
        dist_wei (numpy.array)  : weightings for averaging
        dist_fac (numpy.array)  : total weighting factor


    Find an array of valid indicies.

    Parameters
    ----------
        sc_bdy (numpy.array)      : source data
        logger                    : log of statements

    Returns
    -------
        data_ind (numpy.array)    : indicies of max depth of valid data
        nan_ind (numpy.array)     : indicies where source is land


    Interpolate the source data to the destination grid using weighted average.

    Parameters
    ----------
        sc_bdy (numpy.array)      : source data
        dist_wei (numpy.array)    : weightings for interpolation
        dist_fac (numpy.array)    : sum of weightings
        logger                    : log of statements

    Returns
    -------
        dst_bdy (numpy.array)     : destination bdy points with data from source grid


    Handle all the calls to generate open boundary conditions for a given regional domain.

    Notes
    -----
    This is main entry for processing BDY lateral boundary conditions.
    This is the main script that handles all the calls to generate open
    boundary conditions for a given regional domain. Input options are handled
    in a NEMO style namelist (namelist.bdy). There is an optional GUI allowing
    the user to create a mask that defines the extent of the regional model.

    Parameters
    ----------
        setup_filepath (str) : file path to find namelist.bdy
        mask_gui       (bool): whether use of the GUI is required

    Returns
    -------
        None          : bdy data is written out to NetCDF file


    Write the tidal data to a NetCDF file.

    Parameters
    ----------
        setup_var     (list): Description of arg1
        dst_coord_var (obj) : Description of arg1
        grid          (dict): Description of arg1
        tide_cons     (list): Description of arg1
        cons          (data): cosz, sinz, cosu, sinu, cosv, sinv

    Returns
    -------
        None    : tidal data is written to NetCDF file


    Read mask information from file or open GUI.

    This method reads the mask information from the netcdf file or opens a gui
    to create a mask depending on the mask_gui input. The default mask data
    uses the bathymetry and applies a 1pt halo.

    Args:
    ----
        Setup    (list): settings for bdy
        mask_gui (bool): whether use of the GUI is required

    Returns:
    -------
        bdy_msk (numpy.array) : a mask array of the regional domain


Create a template of bdy netcdf files. A common for T, I, U, V, E grid types.


        Extract monthly data and interpolates onto the destination grid.

        Parameters
        ----------
        year  : year of data to be extracted
        month : month of the year to be extracted

        Returns
        -------
        self.data_out : data from source on bdy locations and depths


        Extract input index elements from array and order them in Fortran array and return the new array.

        Parameters
        ----------
        alpha : input array
        beta  : index array

        Returns
        -------
        alpha : index elements in flat Fortran array


        Translate between calendars and return scale factor and number of days in month.

        Parameters
        ----------
        source  : source calendar
        dest    : destination calendar
        year    : input year
        month   : input month

        Returns
        -------
        sf  : scale factor
        ed  : number of days in month


        Get time delta and number of time steps per day.

        Calculates difference between time steps for time_counter and checks
        these are uniform. Then retrives the number of time steps per day.

        Parameters
        ----------
        time_counter  : model time coordinate

        Returns
        -------
        deltaT   : length of time step
        dstep    : number of time steps per day


        Perform a time interpolation of the BDY data to daily frequency.

        Notes
        -----
        This method performs a time interpolation (if required). This is
        necessary if the time frequency is not a factor of monthly output or the
        input and output calendars differ. CF compliant calendar options
        accepted: gregorian | standard, proleptic_gregorian, noleap | 365_day,
        360_day or julian.*


        Write monthy BDY data to netCDF file.

        Notes
        -----
        This method writes out all available variables for a given grid along with
        any asscoaied metadata. Currently data are only written out as monthly
        files.

        Parameters
        ----------
            year         (int) : year to write out
            month        (int) : month to write out
            ind          (dict): dictionary holding grid information
            unit_origin  (str) : time reference '%d 00:00:00' %date_origin

        Returns
        -------
            None


    Write the data to the netcdf templete file.

    Parameters
    ----------
    filename -- output filename
    variable_name -- variable name into which the data is written to.
    data -- data that will be written to variable in netcdf.


Load the settings from file.


Split the line into key value pair.


Write backs the variable data back into the file.


        Read the variable description data from the 'variable.info' file.

        Notes
        -----
        This method reads the variable description data from 'variable.info' file
        in the pybdy installation path if it can't find the file with the same
        name as input bdy file with extension .info

        Parameters
        ----------
        filename -- filename of the variables information
        returns a dictionary with variable name and its description.

        Returns
        -------
        variable_info : dict


    Trim the sets of lines.

    Notes
    -----
    Removes empty lines/whitespaces and removes comments which start with !.


    Create dictionary of settings.

    Notes
    -----
    This function transverses input string and appends the setting name and its value to dictionary
    of settings and also if the setting name holds a boolean value then to the dictionary
    of boolean variables.
    This function also checks the type and raises error for ambiguous values.


Replace the variable name value with new_value in the original_line.


    Get the variable name.

    Notes
    -----
    Parse the line to find the name and if it is part of the array '()'
    then return name of variable and index of the array. if variable is not
    array then only variable name and -1 in index.


Return a dictionary of variables and also special dictionary for boolean variable.


    Run main function.

    Checks the command line parameters and passes them to the profile module for processing.


        Remove the duplicate points in the bdy_i and return the bdy_i and bdy_r.

        Parameters
        ----------
        bdy_i : bdy indexes
        bdy_r : bdy rim values.

        Returns
        -------
        bdy_i : bdy indexes
        bdy_r : bdy rim values.


Remove the land points and open ocean points.


        Find the border indexes by checking the change from ocean to land.

        Notes
        -----
        Returns the i and j index array where the shift happens.

        Parameters
        ----------
        igrid : I x direction indexes
        jgrid : J y direction indexes
        mask  : mask data
        brg   : mask index range

        Returns
        -------
        bdy_i : bdy indexes
        bdy_r : bdy rim values.


        Find indexes of unique rows in the input 2D array.

        Parameters
        ----------
        t : input 2D array.

        Returns
        -------
        indx : indexes of unique rows


    Master chunking function.

    Takes the boundary indicies and turns them into a list of boundary chunks.
    The boundary is first split at natural breaks like land or the east-west wrap.
    The chunks are then split near corners.
    The chunks are then optionally split in the middle if they're above a certain size
    after attempting to split at corners.

    Parameters
    ----------
        bdy (obj)   : organised as bdy_i[point, i/j grid] and rim width bdy_r[point]
        logger                  : log error and messages

    Returns
    -------
        chunk_number (numpy.array) : array of chunk numbers


    Find natural breaks in the boundary looking for gaps in i and j.

    Parameters
    ----------
        ibdy (numpy.array)         : index in i direction
        jbdy (numpy.array)         : index in j direction
        chunk_number (numpy.array) : array of chunk numbers. -1 means an unassigned chunk number
        rw (int)                   : rimwidth

    Returns
    -------
        chunk_number (numpy.array) : array of chunk numbers


    Find corners and split along the change in direction.

    To do this we look for a change in direction along each rim.

    Parameters
    ----------
        ibdy (numpy.array)         : index in i direction
        jbdy (numpy.array)         : index in j direction
        rbdy (numpy.array)         : rim index
        chunk_number (numpy.array) : array of chunk numbers. -1 means an unassigned chunk number
        rw (int)                   : rimwidth

    Returns
    -------
        chunk_number (numpy.array) : array of chunk numbers


    Split boundaries that have too much white space and are too large.

    Parameters
    ----------
        ibdy (numpy.array)         : index in i direction
        jbdy (numpy.array)         : index in j direction
        chunk_number (numpy.array) : array of chunk numbers. -1 means an unassigned chunk number

    Returns
    -------
        chunk_number (numpy.array) : array of chunk numbers


Calculate long winded equation of two vars; some lam and phi.


    Global Tidal model interpolation onto target grid, including grid rotation.

    Parameters
    ----------
        setup          : settings
        DstCoord       : destination coordinate object
        Grid_T         : t grid bdy_i, grid_type, bdy_r
        Grid_U         : u grid bdy_i, grid_type, bdy_r
        Grid_V         : v grid bdy_i, grid_type, bdy_r
        comp           : dictionary of harmonics read from namelist {'1':"M2" , '2':"<const name>"}

    Returns
    -------
        cosz, sinz, cosu, sinu, cosv, sinv: [# of constituents, number of bdy points]


    Convert the input contituents to index in the tidal constituents.

    Parameters
    ----------
    constituents: The list of constituents available from the source data
        e.g. TPXO: ['m2', 's2', 'n2', 'k2', 'k1', 'o1', 'p1', 'q1', 'mf', 'mm', 'm4', 'ms4', 'mn4']
    inputcons: The dictionary of constituents from the namelist with their numbers
        e.g. {'1': "'M2'", '3': "'K2'", '2': "'S2'", '4': "'M4'"}

    Returns
    -------
    retindx: The indices (relative to the source data list) of the dictionary items from the namelist
        e.g. [  0.   3.   1.  10.]


Interpolates the tidal constituents along the given lat lon coordinates.


Interpolate data data on regular grid for given lonlat coordinates.


Perform a bilinear interpolation of grid where the data values are NaN's.


        Create a boolean mask xr.DataArray from bathymetry.

        TPXO7.2 carries a binary variable called mask and a bathymetry variable
        TPXO9v5 only carries the bathymetry variable
        return: mask dataarray.

        Useage:
            self.grid[mask_name] = generate_landmask(bathy_name)


Interpolate the tidal constituents along the given lat lon coordinates.


Do a bilinear interpolation of grid where the data values are NaN's.


vbox is the top container


Initialise the UI components of the GUI.


        Run callback for the dropdown in the settings.

        Notes
        -----
        Run callback when the True/False dropdown for the settings,
          which has a boolean value, is changed.


        Run callback when the check box state is changed.

        Notes
        -----
        This updates the bool_setting.


        Run callback when save button is clicked.

        Notes
        -----
        This method writes takes the settings values in
        GUI and write them back to file.


Add an new point to the selection list and redraws the selection tool.


        Refresh the canvas.

        Notes
        -----
        This method looks at the list of points available and depending on the number of points
          in the list creates a point or line or a polygon and draws them.


Reset the line i.e removes the line from the axes and resets to None.


Reset the polygon ie. removes the polygon from the axis and reset to None.


Disable the events and the selection.


Draw the selection object.


Redraw the polygon.


Run callback to mouse press event.


Run callback to mouse release event.


Insert a new data point between the segment that is closest in polygon.


Delete the data point under the point in event.


        Run callback for the mouse motion with button press.

        This is to move the edge points of the polygon.


Reset the points in the selection deleting the line and polygon.


Run callback to the rectangleselector.


Disable or removes the box selector.


Reset rectangle polygon.


Read the mask data from the mask file.


Pixels is number of pixels in the border that need applying mask.


Add the masks for the given index values depending on the type of mask selected.


        Return input field indices with bathymetry depth greater than a given depth field.

        Notes
        -----
        Returns the indices from `index` which have bathymetry
        depth greater than the input field `depth`.


Remove the mask for the given index values depending on the type of mask selected.


Remove the small regions in the selection area and takes only the largest area for mask.


Fill the small regions of the selection area and fill them up.


        Tide up the mask by selecting the largest masked region.

        Notes
        -----
        This is to avoid two disconnected masked regions.


Apply the mediterrian mask specific for the test bathymetry file.


:TODO Need to add the override time gui widgets


Run callback for the drawing tool when the signal of change of drawing tool is received.


Draws the basemap and contour with mask information.


Add the selected region in the drawing tool to the mask.


Remove the selected region in the drawing tool from the mask.


Apply a mask of given number of pixels at the border of the mask.


Run callback for freehand button clicked.


Run callback for rectangel button clicked.


Update the height mask buttons in the interface.


Create a mask for the break depth using histograms.


    _Summary.

    Parameters
    ----------
    :param bathy: This is the input bathymetry data
    :param ov: Latittude array
    :param lv: Longitude array
    :type bathy: numpy array
    :type ov: numpy array
    :type lv: numpy array
    :return: returns the ob, lb
    :rtype: numpy arrays

    :Example:


    Calculate the shelf break.

    :param bathy: This is the input bathymetry data
    :param lat: Latittude array
    :param lon: Longitude array
    :param roi: region of interest array [4]
    :param dr: shelf break distance
    :type bathy: numpy array
    :type lat: numpy array
    :type lon: numpy array
    :type roi: python array
    :type dr: float
    :return: returns the depth_shelf, h_max
    :rtype: numpy arrays.

    :Example:


Extract individual byd sections.


    Get the distance of a point to a segment.

    Notes
    -----
    *p*, *s0*, *s1* are *xy* sequences
    This algorithm from
    http://geomalgorithms.com/a02-_lines.html.


Get the source time data information. Builds up sourcedata objects of a given grid.


Update the units and calendar information for the grid.


Return the dimensions of the variables.


Get the difference between the two times in days and hours.


        Calculate the time interval of the each grid.

        If all the grids get the same interval then it sets it to the days and hours.
        Otherwise it throws an error.


        parameters
        ----------
        evt: Event
            The event to run the module on
        station: Station
            The station to run the module on
        det: Detector
            The detector description
        filter_size: size of tukey window (float)
            specifies the percentage of the trace where the filter is active.
            default is 0.1, i.e. the first 5% and the last 5% of the trace are filtered
        prepend: time interval to prepend
            the time span that is filled with zeros and prepended to the trace
        append: time interval to append
            the time span that is filled with zeros and appended to the trace


        Set up module parameters

        Parameters:
        ------------------
        filenames: list of strings
            List of .nur files containing the measured noise
        random_seed: int, default: None
            Seed for the random number generator. By default, no seed is set.
        max_iterations: int, default: 100
            The module will pick a random event from the noise files, until a suitable event is found
            or until the number of iterations exceeds max_iterations. In that case, an error is thrown.
        debug: bool, default: False
            Set True to get debug output
        draw_noise_statistics: boolean, default: False
            If true, the values of all samples is stored and a histogram with noise statistics is drawn
            be the end() method


        Add measured noise to station channels

        Parameters:
        --------------
        event: event object
        station: station object
        det: detector description


        End method. Draws a histogram of the noise statistics and fits a
        Gaussian distribution to it.


        Fits the direction using templates

        Parameters
        ----------
        evt: event

        station: station

        det: detector

        channels_to_use: list (default: [0, 1, 2, 3]
            antenna to use for fit
        cosmic_ray: bool
            type to set correlation template


        reconstruct signal arrival direction for all events

        Parameters
        ----------
        evt: Event
            The event to run the module on
        station: Station
            The station to run the module on
        det: Detector
            The detector description
        n_index: float
            the index of refraction
        ZenLim: 2-dim array/list of floats (default: [0 * units.deg, 90 * units.deg])
            the zenith angle limits for the fit
        AziLim: 2-dim array/list of floats (default: [0 * units.deg, 360 * units.deg])
            the azimuth angle limits for the fit
        channel_pairs: pair of pair of integers
            specify the two channel pairs to use, default ((0, 2), (1, 3))
        use_envelope: bool (default False)
            if True, the hilbert envelope of the traces is used


            Likelihood function for a four antenna ARIANNA station, using correction.
            Using correlation, has no built in wrap around, pulse needs to be in the middle


            Likelihood function for a four antenna ARIANNA station, using FFT convolution
            Using FFT convolution, has built-in wrap around, but ARIANNA signals are too short for it to be accurate
            will show problems at zero time delay


        reconstruct signal arrival direction for all events through beam forming.
        https://arxiv.org/pdf/1009.0345.pdf

        Parameters
        ----------
        evt: Event
            The event to run the module on
        station: Station
            The station to run the module on
        det: Detector
            The detector description
        polarization: int
            0: eTheta
            1: ePhi
        n_index: float
            the index of refraction
        channels: list
            the channel ids
        ZenLim: 2-dim array/list of floats
            the zenith angle limits for the fit
            default if 0-90deg (upward coming signal)
        AziLim: 2-dim array/list of floats
            the azimuth angle limits for the fit
            default is 0-360deg


        Adding random phase information to given amplitude spectrum.

        Parameters
        ---------

        amps: array of floats
            Data that random phase is added to.
        n_samples_time_domain: int
            number of samples in the time domain to differentiate between odd and even number of samples


        Adding random phase information to given amplitude spectrum.

        Parameters
        ---------

        f: array of floats
            Data that random phase is added to.


        Generating noise of n_samples in a bandwidth [min_freq,max_freq].

        Parameters
        ---------

        min_freq: float
            Minimum frequency of passband for noise generation
            min_freq = None: Only the DC component is removed. If the DC component should be included,
            min_freq = 0 has to be specified
        max_freq: float
            Maximum frequency of passband for noise generation
            If the maximum frequency is above the Nquist frequencey (0.5 * sampling rate), the Nquist frequency is used
            max_freq = None: Frequencies up to Nyquist freq are used.
        n_samples: int
            number of samples in the time domain
        sampling_rate: float
            desired sampling rate of data
        amplitude: float
            desired voltage of noise as V_rms (only roughly, since bandpass limited)
        type: string
            perfect_white: flat frequency spectrum
            rayleigh: Amplitude of each frequency bin is drawn from a Rayleigh distribution
            # white: flat frequency spectrum with random jitter
        time_domain: bool (default True)
            if True returns noise in the time domain, if False it returns the noise in the frequency domain. The latter
            might be more performant as the noise is generated internally in the frequency domain.
        bandwidth: float or None (default)
            if this parameter is specified, the amplitude is interpreted as the amplitude for the bandwidth specified here
            Otherwise the amplitude is interpreted for the bandwidth of min(max_freq, 0.5 * sampling rate) - min_freq
            If `bandwidth` is larger then (min(max_freq, 0.5 * sampling rate) - min_freq) it has the same effect as `None`

        Comments
        --------
        *   Note that by design the max frequency is the Nyquist frequency, even if a bigger max_freq
            is implemented (RL 17-Sept-2018)

        *   Add 'multi_white' noise option on 20-Sept-2018 (RL)


        Add noise to given event.

        Parameters
        ---------

        event

        station

        detector

        amplitude: float or dict of floats
            desired voltage of noise as V_rms for the specified bandwidth
            a dict can be used to specify a different amplitude per channel, the key is the channel_id
        min_freq: float
            Minimum frequency of passband for noise generation
        max_freq: float
            Maximum frequency of passband for noise generation
            If the maximum frequency is above the Nquist frequencey (0.5 * sampling rate), the Nquist frequency is used
        type: string
            perfect_white: flat frequency spectrum
            rayleigh: Amplitude of each frequency bin is drawn from a Rayleigh distribution
        excluded_channels: list of ints
            the channels ids of channels where no noise will be added, default is that no channel is excluded
        bandwidth: float or None (default)
            if this parameter is specified, the amplitude is interpreted as the amplitude for the bandwidth specified here
            Otherwise the amplitude is interpreted for the bandwidth of min(max_freq, 0.5 * sampling rate) - min_freq
            If `bandwidth` is larger then (min(max_freq, 0.5 * sampling rate) - min_freq) it has the same effect as `None`


    Simulates a perfect comparator flash ADC that compares the voltage to the
    voltage for the least significative bit and takes the floor or the ceiling
    of their ratio as a digitised value of the trace.

    Parameters
    ----------
    trace: array of floats
        Trace containing the voltage to be digitised
    adc_n_bits: int
        Number of bits of the ADC
    adc_ref_voltage: float
        Voltage corresponding to the maximum number of counts given by the
        ADC: 2**adc_n_bits - 1
    mode: string
        'floor' or 'ceiling'
    output: string
        - 'voltage' to store the ADC output as discretised voltage trace
        - 'counts' to store the ADC output in ADC counts

    Returns
    -------
    digital_trace: array of floats
        Digitised voltage trace in volts or ADC counts


    Perfect comparator ADC that takes the floor value of the comparison.
    See perfect_comparator


    Perfect comparator ADC that takes the floor value of the comparison.
    See perfect_floor.


    Takes a digitised trace in ADC counts and clips the parts of the
    trace with values higher than 2**(adc_n_bits-1)-1 or lower than
    -2**(adc_n_bits-1).

    Parameters
    ----------
    adc_counts_trace: array of floats
        Voltage in ADC counts, unclipped
    adc_n_bits: int
        Number of bits of the ADC
    adc_ref_voltage: float
        Voltage corresponding to the maximum number of counts given by the
        ADC: 2**(adc_n_bits-1) - 1

    Returns
    -------
    saturated_trace: array of floats
        The clipped or saturated voltage trace


        Runs the analogToDigitalConverter and transforms the traces from all
        the channels of an input station to digital voltage values.

        Parameters
        ----------
        evt: framework.event.Event object
        station: framework.station.Station object
        det: detector.detector.Detector object
        clock_offset: float

        adc_type: string
            The type of ADC used. The following are available:
            - perfect_floor_comparator
            See functions with the same name on this module for documentation
        adc_output: string
            - 'voltage' to store the ADC output as discretised voltage trace
            - 'counts' to store the ADC output in ADC counts
        upsampling_factor: integer
            Upsampling factor. The digital trace will be a upsampled to a
            sampling frequency int_factor times higher than the original one


    Solve L x = b, via SVD least squares cutting of small singular values
    L is an array of shape (..., M, N) and b of shape (..., M).
    Returns x of shape (..., N)


        run method. This function is executed for each event

        Parameters
        ---------
        evt
        station
        det
        use_channels: array of ints (default: [0, 1, 2, 3])
            the channel ids to use for the electric field reconstruction
        use_MC_direction: bool
            if True uses zenith and azimuth direction from simulated station
            if False uses reconstructed direction from station parameters.
        force_Polarization: str
            if eTheta or ePhi, then only reconstructs chosen polarization of electric field,
            assuming the other is 0. Otherwise, reconstructs electric field for both eTheta and ePhi


        Parameters
        -----------
        debug: bool
            Set module to debug output
        signal_window_start: float or None
            Start time (relative to the trace start time) of the window in which signal quantities will be calculated, with time units
            If None is passed as a parameter, the signal window is laid around the trace maximum
        signal_window_length: float
            Length of the signal window, with time units
        noise_window_start: float or None
            Start time (relative to the trace start time) of the window in which noise quantities will be calculated, with time units
            If noise_window_start or noise_window_length are None, the noise window is the part of the trace outside the signal window
        noise_window_length: float or None
            Length of the noise window, with time units
            If noise_window_start or noise_window_length are None, the noise window is the part of the trace outside the signal window


        Parameters
        -----------
        evt, station, det
            Event, Station, Detector
        stored_noise: bool
            Calculates noise from pre-computed forced triggers
        rms_stage: string
            See functionality of det.get_noise_RMS


        Setup
        ----
        trigger_name: string or None
            name of the trigger that should be used.
            If trigger_name is None, the trigger with the smalles trigger_time will be used.
            If a name is give, corresponding trigger module must be run beforehand.
            If the trigger does not exist or did not trigger, this module will do nothing
        pre_trigger_time: float
            Amount of time that should be stored in the channel trace before the trigger. If the channel trace is long
            enough, it will be cut accordingly. Otherwise, it will be rolled.


    Numerically compute the covariance matrix from a chi^2 or -logLikelihood function.

    Parameters
    ----------
    function: function-like
      The function may accept only a vector argument and has to return a scalar.
    vmin: array of floats
      Position of the minimum.
    up: float
      Threshold value to pass when climbing uphill.
      up = 1   for a chi^2 function
      up = 0.5 for a -logLikelihood function
    fast: boolean
      If true invert hesse matrix at the minimum, use this if computing function is expensive.

    Examples
    --------
    >>> cov = ((2.0,0.2),(0.2,2.0))
    >>> invcov = np.linalg.inv(cov)
    >>> xs = np.array((1.0,-1.0))
    >>> def ChiSquare(pars, grad = None): return np.dot(xs-pars,np.dot(invcov,xs-pars))
    >>> def NegLogLike(pars, grad = None): return 0.5*ChiSquare(pars)
    >>> covariance(ChiSquare, xs, 1.0)
    array([[ 2. ,  0.2],
           [ 0.2,  2. ]])
    >>> covariance(ChiSquare, xs, 1.0, fast=True)
    array([[ 2. ,  0.2],
           [ 0.2,  2. ]])
    >>> covariance(NegLogLike, xs, 0.5)
    array([[ 2. ,  0.2],
           [ 0.2,  2. ]])
    >>> covariance(NegLogLike, xs, 0.5, fast=True)
    array([[ 2. ,  0.2],
           [ 0.2,  2. ]])

    Notes
    -----
    The algorithm is slow (it needs many function evaluations), but robust.
    The covariance matrix is derived by explicitly following the chi^2
    or -logLikelihood function uphill until it crosses the 1-sigma contour.

    The fast alternative is to invert the hessian matrix at the minimum.

    Author
    ------
    Hans Dembinski <hans.dembinski@kit.edu>


        begin method. This function is executed before the event loop.

        The antenna pattern provider is initialized here.


        run method. This function is executed for each event

        Parameters
        ---------
        evt
        station
        det
        debug: bool
            if True debug plotting is enables
        debug_plotpath: string or None
            if not None plots will be saved to a file rather then shown. Plots will
            be save into the `debug_plotpath` directory
        use_channels: array of ints (default: [0, 1, 2, 3])
            the channel ids to use for the electric field reconstruction
            default: 0 - 3
        bandpass: [float, float] (default: [100 * units.MHz, 500 * units.MHz])
            the lower and upper frequecy for which the analytic pulse is calculated.
            A butterworth filter of 10th order and a rectangular filter is applied.
            default 100 - 500 MHz
        use_MC_direction: bool
            use simulated direction instead of reconstructed direction


        Parameters
        ----------------
        evt: Event
            The event to run the module on
        station: Station
            The station to run the module on
        det: Detector
            The detector description
        channels_to_use: list of int (default: [0, 1, 2, 3])
            List with the IDs of channels to use for reconstruction
        cosmic_ray: Bool (default: False)
            Flag to mark event as cosmic ray


        resample electric field

        Parameters
        ----------
        event: event

        station: station

        det: detector

        sampling_rate: float
            desired new sampling rate


        Performs computation for voltage trace to electric field per channel

        Will provide a deconvoluted (electric field) trace for each channel from the stations input voltage traces

        Paramters
        ---------
        evt: event data structure
            the event data structure
        station: station data structure
            the station data structure
        det: detector object
            the detector object
        pol: polarization
            0 = eTheta polarized, 1 = ePhi polarized


        Applies bandpass filter to electric field

        Parameters
        ----------
        evt: event

        station: station

        det: detector

        passband: seq, array (default: [55 * units.MHz, 1000 * units.MHz])
            passband for filter, in phys units
        filter_type: string
            'rectangular': perfect straight line filter
            'butter': butterworth filter from scipy
            'butterabs': absolute of butterworth filter from scipy
        order: int (optional, default 2)
            for a butterworth filter: specifies the order of the filter


Adds cable delays to channels


        Run the filter

        Parameters
        ---------

        evt, station, det
            Event, Station, Detector
        passband: list or dict of lists, (default: [55 * units.MHz, 1000 * units.MHz])
            passband[0]: lower boundary of filter, passband[1]: upper boundary of filter
            a dict can be used to specify a different bandwidth per channel, the key is the channel_id
        filter_type: string or dict
            'rectangular': perfect straight line filter
            'butter': butterworth filter from scipy
            'butterabs': absolute of butterworth filter from scipy
            or any filter that is implemented in NuRadioReco.detector.filterresponse. In this case the
            passband parameter is ignored
            or 'FIR <type> <parameter>' - see below for FIR filter options

            a dict can be used to specify a different bandwidth per channel, the key is the channel_id
        order: int (optional, default 2) or dict
            for a butterworth filter: specifies the order of the filter
        rp: float
            The maximum ripple allowed below unity gain in the passband. Specified in decibels, as a positive number.
            (for chebyshev filter)

            a dict can be used to specify a different bandwidth per channel, the key is the channel_id
        Added Jan-07-2018 by robert.lahmann@fau.de:
        FIR filter:
        see https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.get_window.html
        for window types; some windows need additional parameters; Default window is hamming
        (does not need parameters). Examples:
        filter_type='FIR' : use hamming window
        filter_type='FIR hamming': same as above
        filter_type='FIR kaiser 10' : Use Kaiser window with beta parameter 10
        filter_type='FIR kaiser' : Use Kaiser window with default beta parameter 6

        In principal, window names are just passed on to signal.firwin(), but if parameters
        are required, then these cases must be explicitly implemented in the code below.

        The four main filter types can be implemented:
        LP: passband[0]=None, passband[1]  = f_cut
        HP: passband[0]=f_cut, passband[1] = None
        BP: passband[0]=f_cut_low, passband[1] = f_cut_high
        BS: passband[0]=f_cut_high, passband[1] = f_cut_low (i.e. passband[0] > passband[1])


        Parameters
        -----------
        evt: Event
            Event to run the module on
        station: Station
            Station to run the module on
        det: Detector
            The detector description
        channels_to_use: List of int (default: [0, 1, 2, 3])
            List of channel IDs for which the template correlation shall be calculated
        cosmic_ray: bool
            Switch for cosmic ray and neutrino analysis. Default is neutrino templates.
        n_templates: int
            default is 1: use just on standard template for all channels
            if n_templates is larger than one multiple templates are used and the
            average cross correlation for all templates is calculated. The set
            of templates contains several coreas input pulses and different
            incoming directions. The index first loops first over 6 different
            coreas pulses with different frequency content
            and then over azimuth angles of 0, 22.5 and 45 degree
            and then over zenith angles of 60, 50 and 70 degree


        reconstructs quantities for electric field

        Parameters
        ----------
        evt: event

        station: station

        det: detector

        debug: bool
            set debug


        Setup method for the module

        Parameters:
        ________________
        electric_field_template: NuRadioReco.framework.base_trace.BaseTrace object (or child of BaseTrace class)
            An electric field waveform to be used as a template. It will be folded with the antenna and amplifier
            response to get a voltage template, which is then used to estimate timing differences between channels.
        medium: NuRadioMC.utilities.medium.Medium object
            The index of refraction profile of the ice.
        use_sim: Boolean (default: False)
            If true, the simulated vertex is used, otherwise it is assumed that the vertex is stored on either the
            vertex_2D_fit (for the neutrino2DVertexReconstructor) or the nu_vertex station parameter


        Run the module on a station

        Parameters:
        _________________
        event: NuRadioReco.framework.event.Event object
            The event the module should be run on
        station: NuRadioReco.framework.station.Station object
            The station the module should be run on
        det: NuRadioReco.detector.detector.Detector object of child object
            The detector description
        channel_ids: array of int
            IDs of the channels the module should be run on
        passband: array of float
            Lower and upper bound of the bandpass filter that is applied to the
            channel waveforms when determining correlation to the template. Can
            be used to filter out frequencies that are dominated by noise.


        Parameters
        -----------
        evt, station, det
            Event, Station, Detector
        window: list or None
            [time_window_start, time_window_end] in which the signal should be kept (in units of time)
        window_function: string
            select window function
            * rectangular
            * hanning
        around_pulse: float or None
            if not None: specifies time interval around 'signal_time',
            if this option is set, 'window' is ignored
        window_width: float
            if around_pulse is set, defines the time width of the trace where the filter is 1.
        window_rise_time: float
            if window_function is not rectangular, defines the rise time where the filter goes from 0 to 1.


        Determines the type of event so that the correct modules can be
        executed accordingly. Currently neutrino and cosmic ray events are
        supported, but others can be added in the future.

        Parameters
        ---------------------
        event: event

        station: station

        mode: string
            specifies which criteria the decision to flag the event as cosmic ray
            or neutrino should be based on. Currently only supports 'forced',
            which automatically flags the event to a specified type. Add new
            modes to use different criteria
        forced_event_type: string
            if the mode is set to forced, this is the type the event will be set to.
            Currently supported options are neutrino and cosmic_ray


        Begin method, sets general parameters of module

        Parameters
        ---------------------
        debug: bool
            enable/disable debug mode (default: False -> no debug output)
        uncertainty: dictionary (default: {})
            optional argument to specify systematic uncertainties. currently supported keys
             * 'sys_dx': systematic uncertainty of x position of antenna
             * 'sys_dy': systematic uncertainty of y position of antenna
             * 'sys_dz': systematic uncertainty of z position of antenna
            * 'sys_amp': systematic uncertainty of the amplifier aplification,
                         specify value as relative difference of linear gain
            * 'amp': statistical uncertainty of the amplifier aplification,
                     specify value as relative difference of linear gain
        time_resolution: float
            time resolution of shifting pulse times
        pre_pulse_time: float
            length of empty samples that is added before the first pulse
        post_pulse_time: float
            length of empty samples that is added after the simulated trace


        Defines number of samples to cut the data to and how many samples before maximum in trace

        Parameters
        -----------
        number_of_samples: int
            Number of samples desired in signal
        offset: int
            (roughly) How many samples before pulse


        Run method for the channelLengthAdjuster

        Parameters
        ..............
        evt: Event object
            The event containing the station whose channels should be cut
        station: Station object
            The station whose channels should be cut
        det: Detector object
            The detector description. It is not actually needed and just
            kept as a parameter to comply with the module template
        channel_ids: List of ints
            Can be used to specify, which channels shall be cut. If it is None,
            all channels are cut.


        Begin the channelResampler

        Parameters
        ---------

        __debug: bool
            Debug switch


        Run the channelResampler

        Parameters
        ---------

        evt, station, det
            Event, Station, Detector
        sampling_rate: float
            In units 1/time provides the desired sampling rate of the data.


        Set up important parameters for the module

        Parameters
        ---------------
        debug: bool, default: False
            It True, debug plots will be shown
        n_side: int, default: 4
            The n_side parameter of the healpix map. Has to be power of 2
            The radio skymap is downsized to the resolution specified by the n_side
            parameter and for every pixel above the horizon the radio noise coming
            from that direction is calculated. The number of pixels used is
            12 * n_side ** 2, so a larger value for n_side will result better accuracy
            but also greatly increase computing time.
        interpolation_frequencies: array of float
            The sky brightness temperature will be evaluated for the frequencies
            in this list. Brightness temperature for frequencies in between are
            calculated by interpolation the log10 of the temperature
            The interpolation_frequencies have to cover the entire passband
            specified in the run method.


        Adds noise resulting from galactic radio emission to the channel traces

        Parameters
        --------------
        event: Event object
            The event containing the station to whose channels noise shall be added
        station: Station object
            The station whose channels noise shall be added to
        detector: Detector object
            The detector description
        passband: list of float
            Lower and upper bound of the frequency range in which noise shall be
            added


        General settings for vertex reconstruction

        Parameters
        -------------
        station_id: integer
            ID of the station to be used for the reconstruction
        channel_ids: array of integers
            IDs of the channels to be used for the reconstruction
        detector: Detector or GenericDetector
            Detector description for the detector used in the reconstruction
        template: BaseTrace object or object of child class
            An electric field to be used to calculate the template which are correlated
            with the channel traces in order to determine the timing difference between
            channels
        distances_2d: array of float
            A list of horizontal distances from the center of the station at which the first
            rough scan to determine the search volume is done. The minimum and maximum of this
            list is later also used as the minimum and maximum distance for the finer search
        azimuths_2d: array of float
            Array of azimuths to be used in the first scan to determine the search volume
        z_coordinates_2d: array of float
            Array of the z coordinates relative to the surface to be used in the first scan
            to determine the search volume. The maximum depth is also used as the maximum
            depth for the finer search
        distance_step_3d: float
            Step size for the horizontal distances used in the finer scan
        widths_3d: array of float
            List of distances to the left and right of the line determined in the first rough
            scan on which the finer scan should be performed
        z_step_3d: float
            Step size for the depts used in the finer scan
        passband: array of float
            Lower and upper bounds off the bandpass filter that is applied to the channel
            waveform and the template before the correlations are determined. This filter
            does not affect the voltages stored in the channels.
        min_antenna_distance: float
            Minimum distance two antennas need to have to be used as a pair in the reconstruction
        debug_folder: string
            Path to the folder in which debug plots should be saved if the debug=True option
            is picked in the run() method.


        General settings for vertex reconstruction

        Parameters
        -------------
        station_id: integer
            ID of the station to be used for the reconstruction
        channel_ids: array of integers
            IDs of the channels to be used for the reconstruction
        detector: Detector or GenericDetector
            Detector description for the detector used in the reconstruction
        passband: array of float or None
            Passband of the filter that should be applied to channel traces before
            calculating the correlation. If None is passed, no filter is applied
        template: array of float or none
            Waveform template with which the channel waveforms are correlated to determine
            the timing differences. If None is passed, the channels are correlated directly
            with each other
        output_path: string or None
            Location where plots of the reconstruction are saved. If None is passed, no plots are
            created.


        Execute the 2D vertex reconstruction

        Parameters
        ---------------
        station: Station
            The station for which the vertex shall be reconstructed
        max_distance: number
            Maximum distance up to which the vertex position shall be searched
        z_width: number
            Vertical size of the search area. If direction_guess is specified, a
            stripe of z_width to each side of the initial direction will be searched.
            If direction_guess is not specified, z_width is the maximum depth up
            to which the vertex will be searched.
        grid_spacing: number
            Distance between two points of the grid on which the vertex is searched
        direction_guess: number, defaults to None
            Zenith for an initial guess of the vertex direction. If specified,
            a strip if width 2*z_width around the guessed direction will be searched
        debug: boolean
            If True, debug plots will be produced
        use_dnr: boolean
            If True, DnR pulses are included in the reconstruction by correlating
            the channel waveforms with themselves.


        Calculate the most likely ray type (direct, reflected
        or refracted) of the signal that reached the detector.
        This is done by taking the reconstructed vertex position,
        calculating the expected time offset between channels and
        checking for which ray type scenario the correlation
        between channels is largest.

        Parameters:
        --------------
        station: station object
            The station on which this reconstruction was run
        ch1: channel object
            The channel for which the ray type shall be determined


begin method, sets general parameters of module


        Switch sim_to_data to go from simulation to data or otherwise.
        The option zero_noise can be used to zero the noise around the pulse. It is unclear, how useful this is.

        Parameters
        -----------
        evt: Event
            Event to run the module on
        station: Station
            Station to run the module on
        det: Detector
            The detector description
        sim_to_data: bool (default False)
            if False, deconvolve the hardware response
            if True, convolve with the hardware response
        phase_only: bool (default False)
            if True, only the phases response is applied but not the amplitude response
        mode: string
            'phase_only': only the phases response is applied but not the amplitude response
                (identical to phase_only=True )
            'relative': gain of amp is divided by maximum of the gain, i.e. at the maximum of the
                filter response is 1 (before applying cable response). This makes it easier
                to compare the filtered to unfiltered signal
            None : default, gain and phase effects are applied 'normally'
        mingainlin: float
            In frequency ranges where the gain gets very small, the reconstruction of the original signal (obtained by
            dividing the measured signal by the gain) leads to excessively high values, due to the effect of
            post-amplifier noise. In order to mitigate this effect, a minimum gain (linear scale!) as fraction of the
            maximum gain can be defined. If specified, any gain value smaller than mingainlin will be replaced by mingainlin.
            Note: The adjustment to the minimal gain is NOT visible when getting the amp response from
            analog_components.get_amplifier_response()


helper function to calculate the time delay of the amp for a delta pulse


        Switch sim_to_data to go from simulation to data or otherwise.
        The option zero_noise can be used to zero the noise around the pulse. It is unclear, how useful this is.

        Parameters
        -----------
        evt: Event
            the event on which to run the module
        station: Station
            The station on which to run the module
        det: Detector or GenericDetector
            The detector description
        sim_to_data: bool (default False)
            if False, deconvolve the hardware response
            if True, convolve with the hardware response
        phase_only: bool (default False)
            if True, only the phases response is applied but not the amplitude response
        mode: string
            'phase_only': only the phases response is applied but not the amplitude response
                (identical to phase_only=True )
            'relativ': gain of amp is divided by maximum of the gain, i.e. at the maximum of the
                filter response is 1 (before applying cable response). This makes it easier
                to compare the filtered to unfiltered signal
            None : default, gain and phase effects are applied 'normally'
        mingainlin: float
            In frequency ranges where the gain gets very small, the reconstruction of the original signal (obtained by
            dividing the measured signal by the gain) leads to excessively high values, due to the effect of
            post-amplifier noise. In order to mitigate this effect, a minimum gain (linear scale!) as fraction of the
            maximum gain can be defined. If specified, any gain value smaller than mingainlin will be replaced by mingainlin.
            Note: The adjustment to the minimal gain is NOT visible when getting the amp response from
            analog_components.get_amplifier_response()


        simulate ARIANNA trigger logic

        Parameters
        ----------
        evt: Event
            Event to run the module on
        station: Station
            Station to run the module on
        det: Detector
            The detector description
        threshold_high: float or dict of floats
            the threshold voltage that needs to be crossed on a single channel on the high side
            a dict can be used to specify a different threshold per channel where the key is the channel id
        threshold_low: float or dict of floats
            the threshold voltage that needs to be crossed on a single channel on the low side
            a dict can be used to specify a different threshold per channel where the key is the channel id
        high_low_window: float
           time window in which a high+low crossing needs to occur to trigger a channel
        n_high_lows: int
            the required number of high or low crossings in a given coincidence window
        coinc_window: float
            time window in which number_concidences channels need to trigger
        number_concidences: int
            number of channels that are requried in coincidence to trigger a station
        triggered_channels: array of ints or None
            channels ids that are triggered on, if None trigger will run on all channels
        trigger_name: string
            a unique name of this particular trigger
        set_not_triggered: bool (default: False)
            if True not trigger simulation will be performed and this trigger will be set to not_triggered


        simulate ARIANNA trigger logic

        Parameters
        ----------
        evt: Event
            The event to run the module on
        station: Station
            The station to run the module on
        det: Detector
            The detector description
        threshold_high: float or dict of floats
            the threshold voltage that needs to be crossed on a single channel on the high side
            a dict can be used to specify a different threshold per channel where the key is the channel id
        threshold_low: float or dict of floats
            the threshold voltage that needs to be crossed on a single channel on the low side
            a dict can be used to specify a different threshold per channel where the key is the channel id
        high_low_window: float
           time window in which a high+low crossing needs to occur to trigger a channel
        coinc_window: float
            time window in which number_concidences channels need to trigger
        number_concidences: int
            number of channels that are requried in coincidence to trigger a station
        triggered_channels: array of ints or None
            channels ids that are triggered on, if None trigger will run on all channels
        trigger_name: string
            a unique name of this particular trigger
        set_not_triggered: bool (default: False)
            if True not trigger simulation will be performed and this trigger will be set to not_triggered


        simulate simple trigger logic, no time window, just threshold in all channels

        Parameters
        ----------
        evt: Event
            The event to run the module on
        station: Station
            The station to run the module on
        det: Detector
            The detector description
        number_concidences: int
            number of channels that are requried in coincidence to trigger a station
        threshold: float or dict of floats
            threshold above (or below) a trigger is issued, absolute amplitude
            a dict can be used to specify a different threshold per channel where the key is the channel id
        triggered_channels: array of ints or None
            channels ids that are triggered on, if None trigger will run on all channels
        coinc_window: float
            time window in which number_concidences channels need to trigger
        trigger_name: string
            a unique name of this particular trigger


        simulates a power integration trigger. The squared voltages are integrated over a sliding window

        Parameters
        ----------
        evt: Event
            The event to run the module on
        station: Station
            The station to run the module on
        det: Detector
            The detector description
        number_concidences: int
            number of channels that are requried in coincidence to trigger a station
        threshold: float or dict of floats
            threshold in units of integrated power (V^2*time)
             a dict can be used to specify a different threshold per channel where the key is the channel id
        integration_window: float
            the integration window
        triggered_channels: array of ints or None
            channels ids that are triggered on, if None trigger will run on all channels
        coinc_window: float
            time window in which number_concidences channels need to trigger
        trigger_name: string
            a unique name of this particular trigger


        Simulates simple threshold trigger based on an Hilbert-envelope of the trace. Passband of the trigger, coincidence
        window within different channels should have triggered, and the number of channels needed to trigger can be specified.

        Parameters
        ----------
        evt: Event
            Event to run the module on
        station: Station
            Station to run the module on
        det: Detector
            The detector description
        passband: list
            Passband of the filter to apply before the trigger
        order: int
            Order of the butterworth filter to apply before the trigger
        threshold: float or dict of floats
            threshold above (or below) a trigger is issued, absolute amplitude
            a dict can be used to specify a different threshold per channel where the key is the channel id
        number_coincidences: int
            number of channels that are required in coincidence to trigger a station
        triggered_channels: array of ints or None
            channels ids that are triggered on, if None trigger will run on all channels
        coinc_window: float
            time window in which number_coincidences channels need to trigger
        trigger_name: string
            a unique name of this particular trigger


Switch sim_to_data to go from simulation to data or otherwise.


        Check if the detector system triggers on a given channel.
        Passes the signal through the tunnel diode. Then compares the maximum
        and minimum values to a tunnel diode noise signal. Triggers if one of
        the maximum or minimum values exceed the noise mean +/- the noise rms
        times the power threshold.
        Parameters
        ----------
        channel : Channel
            ``Channel`` object on which to test the trigger condition.
        Returns
        -------
        boolean
            Whether or not the antenna triggers on `channel`.


        simulate ARA trigger logic

        Parameters
        ----------
        evt: Event
            The event on which to run the module
        station: Station
            The station on which to run the module
        det: Detector or GenericDetector
            The detector description
        power_threshold: float
            The factor of sigma that the signal needs to exceed the noise
        coinc_window: float
            time window in which number_concidences channels need to trigger
        number_concidences: int
            number of channels that are requried in coincidence to trigger a station
        triggered_channels: array of ints
            channels ids that are triggered on
        power_mean : float
            Parameter extracted in ARA from noise.
            If not given, it is calculated from generic noise
        power_std : float
            Parameter extracted in ARA from noise.
            If not given, it is calculated from generic noise
        trigger_name: string
            a unique name of this particular trigger


        Calculates the envelope trigger for a certain phasing configuration.
        Beams are formed. Then, each channel to be phased is filtered with a
        tunnel diode, the outputs are phased and, if the minimum is lower than
        the number of antennas times (power_mean - power_std * np.abs(threshold_factor)),
        a trigger is created.

        Parameters
        ----------
        station: Station object
            Description of the current station
        det: Detector object
            Description of the current detector
        beam_rolls: array of ints
            Contains the integers for rolling the voltage traces (delays)
        triggered_channels: array of ints
            Ids of the triggering channels
        threshold_factor: float
            the threshold factor
        power_mean: float
            mean of the noise trace after being filtered with the diode
        power_std: float
            standard deviation of the noise trace after being filtered with the
            diode. power_mean and power_std can be calculated with the function
            calculate_noise_parameters from utilities.diodeSimulator
        output_passband: (float, float) tuple
            Frequencies for a 6th-order Butterworth filter to be applied after
            the diode filtering.
        cut_times: (float, float) tuple
            Times for cutting the trace after diode filtering. This helps reducing
            the number of noise-induced triggers. Doing it the other way, that is,
            cutting and then filtering, will create two artificial pulses on the
            edges of the trace.
        trigger_adc: bool
            If True, analog to digital conversion is performed. It must be specified in the
            detector file. See analogToDigitalConverter module for information

        Returns
        -------
        is_triggered: bool
            True if the triggering condition is met
        trigger_delays: dictionary
            the delays for the primary channels that have caused a trigger.
            If there is no trigger, it's an empty dictionary


        simulates phased array trigger for each event

        Several channels are phased by delaying their signals by an amount given
        by a pointing angle. Several pointing angles are possible in order to cover
        the sky. The array triggered_channels controls the channels that are phased,
        according to the angles phasing_angles. A secondary phasing that is added
        to this primary phasing is possible, and it is controlled by the parametres
        secondary_channels and secondary_phasing_angles.

        Parameters
        ----------
        evt: Event object
            Description of the current event
        station: Station object
            Description of the current station
        det: Detector object
            Description of the current detector
        threshold_factor: float
            threshold factor to be used for the envelope trigger
        power_mean: float
            mean of the noise trace after being filtered with the diode
        power_std: float
            standard deviation of the noise trace after being filtered with the
            diode. power_mean and power_std can be calculated with the function
            calculate_noise_parameters from utilities.diodeSimulator
        triggered_channels: array of ints
            channels ids of the channels that form the primary phasing array
            if None, all channels are taken
        trigger_name: string
            name for the trigger
        phasing_angles: array of float
            pointing angles for the primary beam
        set_not_triggered: bool (default: False)
            if True not trigger simulation will be performed and this trigger will be set to not_triggered
        ref_index: float
            refractive index for beam forming
        output_passband: (float, float) tuple
            Frequencies for a 6th-order Butterworth filter to be applied after
            the diode filtering.
        cut_times: (float, float) tuple
            Times for cutting the trace after diode filtering. This helps reducing
            the number of noise-induced triggers. Doing it the other way, that is,
            cutting and then filtering, will create two artificial pulses on the
            edges of the trace.
        trigger_adc: bool
            If True, analog to digital conversion is performed. It must be specified in the
            detector file. See analogToDigitalConverter module for information

        Returns
        -------
        is_triggered: bool
            True if the triggering condition is met


        Define settings for the reconstruction.

        Parameters
        -------------
        electric_field_template: NuRadioReco.framework.base_trace.BaseTrace object
            BaseTrace (or child class) object containing an electric field template
            that is used to determine the position of the radio pulse in the channel
            waveforms.
        passband: list of floats or None
            Lower and upper bound of the filter that should be applied to the channel
            waveforms and the IFT model. If None is passed, no filter is applied
        filter_type: string
            Name of the filter type to be used. Has to be implemented in the NuRadioReco.utilities.
            bandpass_filter.get_filter_response function. Only used if passband is not None
        amp_dct: dictionary
            Dictionary containing the prior settings for the electric field spectrum
        pulse_time_prior: float
            Expected pulse time relative to the trace start time. Note that this is the time of the
            electric field pulse, not the voltage pulse
        pulse_time_uncertainty: float
            Uncertainty on the pulse time
        n_iterations: integer
            Number of times the IFT minimizer iterates. More iterations lead to better results, but
            increase run time.
        n_samples: integer
            Number of prior samples the IFT minimizer uses to find the maximum prior. Also the number of
            samples used to estimate uncertainties
        polarization: string
            Polarization of the reconstructed radio signal. If set to "theta" or "phi", only that
            component of the electric field is reconstructed. If set to "pol", both components
            are reconstructed.
        relative_tolerance: float
            Relative improvement for the minimizer in a cycle for the optimization to finish.
        convergence_level: integer
            Number of cycles the relative improvement of the minimizer has to be below relative_tolerance
            for the optimization to finish.
        energy_fluence_passbands: list of floats
            List of passbands for which the energy fluence is calculated
        slope_passbands: list of floats
            List of passbands to calculate the ratio of the energy fluences in different passbands.
        phase_slope: string
            Specifies the sign of the slope of the linear function describing the phase of the electric field.
            Options are "negative", "positive" and "both". If "both" is selected, positive and negative slopes
            are used and the best fit is selected.
        debug: bool
            If true, debug plots are drawn.


        Plots samples from the prior distribution of the electric field.

        Parameters
        --------------
        event: NuRadioReco.framework.event.Event object
        station: NuRadioReco.framework.station.Station object
        detector: NuRadioReco.detector.detector.Detector object or child object
        channel_ids: list of floats
            IDs of the channels to use for the electric field reconstruction


        Run the electric field reconstruction

        Parameters
        ----------------
        event: NuRadioReco.framework.event.Event object
        station: NuRadioReco.framework.station.Station object
        detector: NuRadioReco.detector.detector.Detector object or child object
        channel_ids: list of integers
            IDs of the channels to be used for the electric field reconstruction
        efield_scaling: boolean
            If true, a small variation in the amplitude between channels is included
            in the IFT model.
        use_sim: boolean
            If true, the simChannels are used to identify the position of the radio pulse.


        Prepares the channel waveforms for the reconstruction by correcting
        for time differences between channels, cutting them to the
        right size and locating the radio pulse.


Creates the operators to simulate the detector response.


Creates the IFT model from which the maximum posterior is calculated


Ads electric fields containing the reconstruction results to the station


Creates an electric field object containing the reconstruction results.


Draws samples from the prior distribution of the electric field spectrum.


Draw plots showing the results of the reconstruction.


    Decorator for run methods. This decorator registers the run methods. It allows to keep track of
    which module is executed in which order and with what parameters. Also the execution time of each
    module is tracked.


        Calculates the delays needed for phasing the array.

        Parameters
        ----------
        station: Station object
            Description of the current station
        det: Detector object
            Description of the current detector
        triggered_channels: array of ints
            channels ids of the channels that form the primary phasing array
            if None, all channels are taken
        phasing_angles: array of float
            pointing angles for the primary beam
        ref_index: float
            refractive index for beam forming
        sampling_frequency: float
            Rate of the ADC used

        Returns
        -------
        beam_rolls: array of dicts of keys=antenna and content=delay