Esempio n. 1
0
    def compute_group(cls, data, scales, **params):
        sample = data['sample'].sort_values()
        alpha, beta = params['alpha_beta']
        quantiles = params['quantiles']

        if quantiles is None:
            quantiles = plotting_positions(sample, alpha, beta)
        elif len(quantiles) != len(sample):
            raise PlotnineError(
                "The number of quantile values is not the same as "
                "the number of sample values.")

        quantiles = np.asarray(quantiles)
        cdist = get_continuous_distribution(params['distribution'])
        theoretical = cdist.ppf(quantiles, *params['dparams'])
        return pd.DataFrame({'sample': sample, 'theoretical': theoretical})
def qqcalc(data, distrib=ssd.norm, alpha=.4, beta=.4):
    """
    Returns the theoretical quantiles from an empirical distribution.
    
    Parameters
    ----------
    data : array
        Input data
    distrib : {norm, function}, optional
        Theoretical distribution used to compute the expected quantiles.
        If None, use a normal distribution.
        Otherwise, ``distrib`` must have a :meth:`.ppf` method.
    alpha : {float}, optional
        Coefficient for the computation of plotting positions
    beta : {float}, optional
        Coefficient for the computation of plotting positions.

    """
    pp = mstats.plotting_positions(data, alpha=alpha, beta=beta)
    qq = ma.fix_invalid(distrib.ppf(pp))
    qq._mask = pp._mask
    return qq
Esempio n. 3
0
def test_plotting_positions():
    # Regression test for #1256
    pos = mstats.plotting_positions(np.arange(3), 0, 0)
    assert_array_almost_equal(pos.data, np.array([0.25, 0.5, 0.75]))
Esempio n. 4
0
def test_plotting_positions():
    # Regression test for #1256
    pos = mstats.plotting_positions(np.arange(3), 0, 0)
    assert_array_almost_equal(pos.data, np.array([0.25, 0.5, 0.75]))
Esempio n. 5
0
def returnForecastDist(fileLoc, forecastFileName):
    forecast = pd.DataFrame(
        pd.read_csv(os.path.join(fileLoc, forecastFileName)))
    forecast = forecast[['EVENT', 'FCST.VOL']]
    forecast['PROB'] = plotting_positions(forecast['FCST.VOL'], 0, 0)
    return forecast
Esempio n. 6
0
#data for interpolating damage
dataHistoric = pd.read_csv(
    r"X:\CRT2014\PDT\WAT\FRA-Results\Dataprocessing_tools\Post Processing Scripts - R and Python\TiltonPython\data\flowDamageData.csv"
)
#data for location->reach
ccpData = pd.DataFrame(
    pd.read_table(
        r"X:\CRT2014\PDT\WAT\FRA-Results\Dataprocessing_tools\Post Processing Scripts - R and Python\TiltonPython\data\damage_ccp_classifications.txt"
    ))

#Curent forecast data
forecastData = pd.DataFrame(
    pd.read_csv(
        r"X:\CRT2014\PDT\WAT\FRA-Results\Dataprocessing_tools\Post Processing Scripts - R and Python\TiltonPython\data\forecast.csv"
    ))[['EVENT', 'FCST.VOL']]
forecastData['PROB'] = plotting_positions(forecastData['FCST.VOL'], 0, 0)
fcstVol = dict(zip(forecastData['EVENT'], forecastData['FCST.VOL']))
fcstProb = dict(zip(forecastData['EVENT'], forecastData['PROB']))


def returnForecastDist(fileLoc, forecastFileName):
    forecast = pd.DataFrame(
        pd.read_csv(os.path.join(fileLoc, forecastFileName)))
    forecast = forecast[['EVENT', 'FCST.VOL']]
    forecast['PROB'] = plotting_positions(forecast['FCST.VOL'], 0, 0)
    return forecast


ex = "SELECT Path_ID, Part_A, Part_B, Part_C, Part_D, Part_E, Part_F, Label FROM master_plot WHERE "
paramDict = {
    'maxOutFlow': {
Esempio n. 7
0
def func(df, x):
    df['plotting_positions'] = (1- plotting_positions(df[x], 0, 0)) *100
    return df