Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CS 519 - Scientific Visualization
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
kamenon2
CS 519 - Scientific Visualization
Commits
479d1253
Commit
479d1253
authored
4 years ago
by
kamenon2
Browse files
Options
Downloads
Patches
Plain Diff
Update Assignment-1/mars.png, Assignment-1/color-map.py, README.md files
parent
84fd177a
Branches
master
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#189143
failed
4 years ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Assignment-1/color-map.py
+49
-0
49 additions, 0 deletions
Assignment-1/color-map.py
Assignment-1/mars.png
+0
-0
0 additions, 0 deletions
Assignment-1/mars.png
README.md
+8
-2
8 additions, 2 deletions
README.md
with
57 additions
and
2 deletions
Assignment-1/color-map.py
0 → 100644
+
49
−
0
View file @
479d1253
# Rainbow color map
import
numpy
as
np
import
math
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
matplotlib.image
as
mpimg
from
matplotlib
import
cm
from
matplotlib.colors
import
ListedColormap
,
LinearSegmentedColormap
def
cm_rainbow
(
x
):
x
=
min
(
max
(
x
,
0
),
1
)
offset
=
0.8
c
=
(
6
-
2
*
offset
)
*
x
+
offset
R
=
max
(
0
,
(
3
-
math
.
fabs
(
c
-
4
)
-
math
.
fabs
(
c
-
5
))
/
2.0
)
# RED
G
=
max
(
0
,
(
4
-
math
.
fabs
(
c
-
2
)
-
math
.
fabs
(
c
-
4
))
/
2.0
)
# GREEN
B
=
max
(
0
,
(
3
-
math
.
fabs
(
c
-
1
)
-
math
.
fabs
(
c
-
2
))
/
2.0
)
# BLUE
return
R
,
G
,
B
mars_gray
=
mpimg
.
imread
(
'
mars.png
'
)
lum_img
=
mars_gray
[:,
:,
0
]
viridis
=
cm
.
get_cmap
(
'
viridis
'
,
8
)
print
(
viridis
(
0.56
))
print
(
'
viridis.colors
'
,
viridis
.
colors
)
print
(
'
viridis(range(8))
'
,
viridis
(
range
(
8
)))
print
(
'
viridis(np.linspace(0, 1, 8))
'
,
viridis
(
np
.
linspace
(
0
,
1
,
8
)))
cdict
=
{
'
red
'
:
[[
0.0
,
0.0
,
0.0
],
[
0.2
,
0.0
,
0.14
],
[
0.75
,
1.0
,
1.0
],
[
1.0
,
0.7
,
0.7
]],
'
green
'
:
[[
0.0
,
0.0
,
0.14
],
[
0.24
,
0.14
,
0.24
],
[
0.3
,
0.7
,
0.7
],
[
0.4
,
0.3
,
0.0
],
[
1.0
,
0.0
,
0.0
]],
'
blue
'
:
[[
0.0
,
1.0
,
1.0
],
[
0.28
,
0.0
,
0.0
],
[
1.0
,
0.0
,
0.0
]]}
mars_colormap
=
LinearSegmentedColormap
(
'
testCmap
'
,
segmentdata
=
cdict
,
N
=
256
)
mars_red
=
mars_colormap
(
lum_img
)
plt
.
matshow
(
mars_red
)
if
__name__
==
'
__main__
'
:
r
,
g
,
b
=
cm_rainbow
(
5
)
This diff is collapsed.
Click to expand it.
Assignment-1/mars.png
0 → 100644
+
0
−
0
View file @
479d1253
288 KiB
This diff is collapsed.
Click to expand it.
README.md
+
8
−
2
View file @
479d1253
...
...
@@ -2,6 +2,12 @@
Project and Assignments for scientific visualization
## Quiz 1:
8 Solutions would be pasted here.
## Quiz 1:
mario to luigi
## Quiz 2: TODO:
## Assignment 1: Color map
-
https://www.coursera.org/learn/cs-519/lecture/ZYQJs/colormaps
-
https://www.kennethmoreland.com/color-advice/
-
https://matplotlib.org/tutorials/introductory/images.html
-
https://matplotlib.org/3.3.1/tutorials/colors/colormap-manipulation.html
## Quiz 2: No real coding questions
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