Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
rhaase
lecture_applied_bioimage_analysis_2020
Commits
fbc425bb
Commit
fbc425bb
authored
Jun 09, 2020
by
rhaase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added exercise solutions
parent
0820e4c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-0
09_Scientific_Data_Analysis_Python/exercises/box_plot.py
09_Scientific_Data_Analysis_Python/exercises/box_plot.py
+14
-0
09_Scientific_Data_Analysis_Python/exercises/stats_for_loop.py
...ientific_Data_Analysis_Python/exercises/stats_for_loop.py
+23
-0
09_Scientific_Data_Analysis_Python/exercises/stats_numpy.py
09_Scientific_Data_Analysis_Python/exercises/stats_numpy.py
+19
-0
No files found.
09_Scientific_Data_Analysis_Python/exercises/box_plot.py
0 → 100644
View file @
fbc425bb
import
matplotlib.pyplot
as
plt
# data
mutant
=
[
1
,
3
,
2
,
1
,
5
,
7
,
3
,
5
]
control
=
[
6
,
7
,
1
,
8
,
3
,
7
,
8
,
6
]
# draw a box plot
data
=
[
mutant
,
control
]
fig1
,
ax1
=
plt
.
subplots
()
ax1
.
set_title
(
'Basic Plot'
)
ax1
.
boxplot
(
data
)
plt
.
show
()
\ No newline at end of file
09_Scientific_Data_Analysis_Python/exercises/stats_for_loop.py
0 → 100644
View file @
fbc425bb
measurements
=
[
1
,
7
,
3
,
4
,
0
,
5
,
4
,
2
,
8
,
7
]
# determine sum of all measurements
sum
=
0
for
number
in
measurements
:
sum
=
sum
+
number
# determine mean of all measurements
number_of_measurements
=
len
(
measurements
)
mean
=
sum
/
number_of_measurements
print
(
"Mean: "
+
str
(
mean
))
# go through measurements again and calculate standard deviation
squared_sum
=
0
for
number
in
measurements
:
squared_sum
+=
pow
(
number
-
mean
,
2
)
/
number_of_measurements
from
math
import
sqrt
standard_deviation
=
sqrt
(
squared_sum
)
print
(
"Standard deviation: "
+
str
(
standard_deviation
))
\ No newline at end of file
09_Scientific_Data_Analysis_Python/exercises/stats_numpy.py
0 → 100644
View file @
fbc425bb
measurements
=
[
1
,
7
,
3
,
4
,
0
,
5
,
4
,
2
,
8
,
7
]
import
numpy
as
np
minimum
=
np
.
min
(
measurements
)
print
(
"Mean: "
+
str
(
minimum
))
maximum
=
np
.
max
(
measurements
)
print
(
"Mean: "
+
str
(
maximum
))
mean
=
np
.
mean
(
measurements
)
print
(
"Median: "
+
str
(
mean
))
median
=
np
.
median
(
measurements
)
print
(
"Mean: "
+
str
(
median
))
standard_deviation
=
np
.
std
(
measurements
)
print
(
"Standard deviation: "
+
str
(
standard_deviation
))
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment