Extremes

First order phase transition

The divergent statistical behavior indeed corresponds to the fact that rare and catastrophic events will make dominant contributions. In cascades, the flux energy is maintained by instabilities of all intensities. The transition from soft to hard processes corresponds to the fact that microscopic activity cannot be removed to yield a purely macroscopic description of the system. In this exercise we use velocity data from geophysical environment (lake) to illustrate the first order phase transition and the calculation of . As we sad in the previous lectures, the velocity field can be generated according to the cascade phenomenology.

Question

  • Download the given data and load it in your work directory.

  • Calculate the following statistics : mean, variance and standard deviation.

  • Sort the negative values of the data and calculate their probability according to Weibull distribution

  • Plot in log-log the Pdf Vs the observation and estimate the .

data.zip

Solution
1
# -*- coding: utf-8 -*-
2
"""
3
@author: yacine.mezemate
4
"""
5
6
import numpy as np
7
import matplotlib.pyplot as plt
8
9
10
########################### Data ###############################
11
#Import data
12
data = np.genfromtxt("dataQd.txt", delimiter= '')
13
data = np.diff(data) # use the difference
14
15
plt.figure(0)
16
plt.plot(data)
17
plt.title("Data sample", fontsize = 18)
18
plt.ylabel("$\Delta v$", fontsize=16)
19
plt.xlabel("$time$", fontsize=16)
20
plt.show()
21
22
############################# Statistics ########################
23
mu = np.mean(data) # mean
24
Var = np.var(data) # variance
25
std = np.sqrt(Var) # standard deviation
26
27
############################# Pdf calculation ###################
28
# Calculate and plot the Empirical PDF using Weibull distribution
29
neg = abs(np.sort(data[data<0])) # sort negative values
30
P_neg = np.arange(len(neg), dtype = np.double)/len(neg) # probability of negative values
31
32
x = np.log(neg)
33
y = np.log(P_neg)
34
35
############################# qd calculation ####################
36
#Qd
37
poly = np.polyfit(x[1:1000], y[1:1000],1)
38
test = np.poly1d(poly)
39
40
############################# plots ##############################
41
plt.figure(1)
42
plt.plot(x, y, marker='+', label ="Empirical Estimation") # plot PDF
43
plt.plot([x[1],x[1000]], [test(x[1]),test(x[1000])], lw = 6, label= "qd="+str(poly[0]))
44
45
# Plot informations
46
plt.legend(loc="down left")
47
plt.title("Probability distribution", fontsize = 18)
48
plt.ylabel("$\log(Pr(\Delta v))$", fontsize=16)
49
plt.xlabel("$\log(\Delta v)$", fontsize=16)
50
plt.show()
(a) : Pdf calculation and qd estimation; (b) : used data sample
PreviousPreviousNextNext
HomepageHomepagePrintPrintCreated with Scenari (new window)