Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SciProg2024
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
pclark3
SciProg2024
Commits
4aad9d2f
Commit
4aad9d2f
authored
1 year ago
by
cprutean
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
cd2aedbe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CodeExamples/GaussianNoisePlot.ipynb
+68
-0
68 additions, 0 deletions
CodeExamples/GaussianNoisePlot.ipynb
with
68 additions
and
0 deletions
CodeExamples/GaussianNoisePlot.ipynb
0 → 100644
+
68
−
0
View file @
4aad9d2f
{
"cells": [
{
"cell_type": "markdown",
"id": "0758d75a",
"metadata": {},
"source": [
"# Gaussian Noise Plot"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f0193150",
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
" Plot a histogram of Gaussian noise\n",
"\"\"\"\n",
"\n",
"import math\n",
"import random\n",
"import matplotlib.pyplot as plt # Import the plot package as plt\n",
"\n",
"def main():\n",
"\n",
" point = 10000 # Number of points\n",
" gauss_data = [] # list to hold points\n",
" mean = 20.0 # mean of noise\n",
" sd = 2.0 # standard deviation of noise\n",
"\n",
"\n",
" while point >= 0: # Fill list with gauss randoms\n",
" gauss_data.append(random.gauss(mean,sd))\n",
" point -= 1\n",
"\n",
" # Plot histogram with 40 bins and range of mean +/- 3sd\n",
" plt.hist(gauss_data, bins = 40, range = [mean - 3*sd , mean + 3*sd])\n",
" plt.title(\"Histogram of Gaussian Noise\")\n",
" plt.show()\n",
"\n",
"main()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:markdown id:0758d75a tags:
# Gaussian Noise Plot
%% Cell type:code id:f0193150 tags:
```
python
"""
Plot a histogram of Gaussian noise
"""
import
math
import
random
import
matplotlib.pyplot
as
plt
# Import the plot package as plt
def
main
():
point
=
10000
# Number of points
gauss_data
=
[]
# list to hold points
mean
=
20.0
# mean of noise
sd
=
2.0
# standard deviation of noise
while
point
>=
0
:
# Fill list with gauss randoms
gauss_data
.
append
(
random
.
gauss
(
mean
,
sd
))
point
-=
1
# Plot histogram with 40 bins and range of mean +/- 3sd
plt
.
hist
(
gauss_data
,
bins
=
40
,
range
=
[
mean
-
3
*
sd
,
mean
+
3
*
sd
])
plt
.
title
(
"
Histogram of Gaussian Noise
"
)
plt
.
show
()
main
()
```
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