Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Seasonal study of user demand and IT system usage in datacenters
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
Open Science
Seasonal study of user demand and IT system usage in datacenters
Commits
71f80d27
Commit
71f80d27
authored
11 months ago
by
dlandre2
Browse files
Options
Downloads
Patches
Plain Diff
title + xlabel + print in perdiodograms.py
parent
6f6039fd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.idea/.name
+1
-1
1 addition, 1 deletion
.idea/.name
hpc_case/periodograms.py
+21
-3
21 additions, 3 deletions
hpc_case/periodograms.py
with
22 additions
and
4 deletions
.idea/.name
+
1
−
1
View file @
71f80d27
characterizationUseCase.py
\ No newline at end of file
periodograms.py
\ No newline at end of file
This diff is collapsed.
Click to expand it.
hpc_case/periodograms.py
+
21
−
3
View file @
71f80d27
...
...
@@ -20,7 +20,7 @@ def filterTime(series, filterTimeInSec):
return
seriesFiltered
def
differentiateSeries
(
series
):
# Differentiating a non-stationary time series with no trend
print
(
"
D
ifferentiation
"
)
print
(
"
A d
ifferentiation
of the time series is necessary. There is no trend
\n
"
)
seriesDiff
=
[]
for
i
in
range
(
len
(
series
)
-
1
):
seriesDiff
.
append
(
series
[
i
]
-
series
[
i
+
1
])
...
...
@@ -28,10 +28,13 @@ def differentiateSeries(series): # Differentiating a non-stationary time series
def
printPeriodogram
(
series
):
# Show periodogram and top 8 frequencies in time series.
print
(
"
Displaying the periodogram of the time series
\n
"
)
# Periodogram
freqencies
,
spectrum
=
periodogram
(
series
)
plt
.
plot
(
freqencies
,
spectrum
,
color
=
'
blue
'
)
plt
.
grid
(
True
,
linestyle
=
'
-
'
,
which
=
'
major
'
,
alpha
=
0.5
,
axis
=
'
both
'
)
plt
.
title
(
"
Periodogram of the time series
"
)
plt
.
xlabel
(
'
Frequency (Hz)
'
,
fontsize
=
45
)
plt
.
ylabel
(
'
Power spectral density
'
,
fontsize
=
45
)
plt
.
xticks
(
fontsize
=
40
)
...
...
@@ -50,6 +53,8 @@ def printPeriodogram(series): # Show periodogram and top 8 frequencies in time s
print
(
val
)
def
stationaryTestsResults
(
series
,
alpha
):
# Assessing the stationarity of a time series using ADF and KPSS tests
print
(
"
Testing the stationarity of the time series
"
)
# ADF test
testAdf
=
adfuller
(
series
)
# p-value
...
...
@@ -61,35 +66,47 @@ def stationaryTestsResults(series, alpha): # Assessing the stationarity of a tim
print
(
"
The p-value KPSS:
"
,
testKpss
[
1
])
if
testAdf
[
1
]
<=
alpha
<=
testKpss
[
1
]:
print
(
"
The series is stationary
"
)
print
(
"
The
time
series is stationary
\n
"
)
else
:
print
(
"
The series is not stationary
"
)
print
(
"
The
time
series is not stationary
\n
"
)
def
removeTrend
(
series
,
granularity
):
# Removing the trend component from the time series if it is present
print
(
"
A trend component is present
"
)
print
(
"
Displaying the time series with trend
\n
"
)
x_abs
=
[
i
for
i
in
range
(
len
(
series
))]
low
=
lowess
(
series
,
x_abs
,
frac
=
granularity
)
low
=
[
v
[
1
]
for
v
in
low
]
plt
.
plot
(
series
)
plt
.
title
(
"
Time series with trend
"
)
plt
.
plot
(
low
)
plt
.
xlabel
(
"
time (hour)
"
)
plt
.
show
()
series_without_trend
=
[
val
-
tr
for
val
,
tr
in
zip
(
series
,
low
)]
print
(
"
Displaying the time series without its trend
\n
"
)
plt
.
plot
(
series_without_trend
)
plt
.
title
(
"
Time series without trend
"
)
plt
.
xlabel
(
"
time (hour)
"
)
plt
.
show
()
return
series_without_trend
def
plotSeries
(
series
):
plt
.
plot
(
series
)
plt
.
title
(
"
Time series
"
)
plt
.
xlabel
(
"
time (hour)
"
)
plt
.
show
()
def
execution
(
List
):
for
l
in
List
:
print
(
"
######################################
"
)
print
(
l
[
2
])
X
=
filterTime
(
l
[
0
],
l
[
1
])
print
(
"
Displaying the time series
\n
"
)
plotSeries
(
X
)
stationaryTestsResults
(
X
,
alphaUsed
)
if
l
[
3
]
==
"
T
"
:
...
...
@@ -97,6 +114,7 @@ def execution(List):
stationaryTestsResults
(
X
,
alphaUsed
)
elif
l
[
3
]
==
"
D
"
:
X
=
differentiateSeries
(
X
)
print
(
"
Displaying the differentiate time series
\n
"
)
plotSeries
(
X
)
stationaryTestsResults
(
X
,
alphaUsed
)
printPeriodogram
(
X
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment