Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Deep Unfolding RPCA
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
MINDS
These Vassili PUSTOVALOV
Deep Unfolding RPCA
Commits
e6dea588
Commit
e6dea588
authored
1 month ago
by
vpustova
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
e766c3e3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SimPlatform/ZoneBubbles.py
+90
-0
90 additions, 0 deletions
SimPlatform/ZoneBubbles.py
with
90 additions
and
0 deletions
SimPlatform/ZoneBubbles.py
0 → 100644
+
90
−
0
View file @
e6dea588
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 13:18:56 2018
@author: Yi Zhang
"""
import
numpy
as
np
from
SimPlatform.Parameters
import
params_default
class
ZoneBubbles
:
def
__init__
(
self
,
params
=
params_default
):
self
.
pixel
=
params
[
'
pixel
'
]
self
.
shape
=
(
params
[
'
shape
'
][
0
:
2
])
self
.
dt
=
params
[
'
dt
'
]
self
.
xrange
=
np
.
array
([
-
0.5
,
self
.
shape
[
1
]
-
0.5
])
*
self
.
pixel
[
0
]
self
.
yrange
=
np
.
array
([
-
0.5
,
self
.
shape
[
0
]
-
0.5
])
*
self
.
pixel
[
1
]
self
.
vmean
=
params
[
'
vmean
'
]
#self.p_birth=params['p_birth']
#self.p_death=params['p_death']
self
.
muv
=
params
[
'
muv
'
]
self
.
sigmav
=
params
[
'
sigmav
'
]
self
.
sigmaa
=
params
[
'
sigmaa
'
]
self
.
sigmaA
=
params
[
'
sigmaA
'
]
self
.
bubbleAM
=
params
[
'
bubbleAM
'
]
#self.sdv_phib=params['sdv_phib']
#location of bubbles
S
=
self
.
shape
[
0
]
*
self
.
shape
[
1
]
*
self
.
pixel
[
0
]
*
self
.
pixel
[
1
]
num
=
int
(
S
*
np
.
random
.
rand
()
*
params
[
'
density
'
]
/
1e2
)
#the unit of density: cm^(-2)
self
.
x
=
np
.
random
.
uniform
(
-
0.5
,
self
.
shape
[
1
]
-
0.5
,[
num
])
*
self
.
pixel
[
0
]
self
.
y
=
np
.
random
.
uniform
(
-
0.5
,
self
.
shape
[
0
]
-
0.5
,[
num
])
*
self
.
pixel
[
1
]
#velocity of bubbles
v
=
self
.
vmean
*
np
.
random
.
normal
(
self
.
muv
,
self
.
sigmav
,[
num
])
v
[
v
<
0
]
=
0
theta
=
np
.
random
.
uniform
(
0
,
2
*
np
.
pi
,[
num
])
self
.
vx
=
v
*
np
.
cos
(
theta
)
self
.
vy
=
v
*
np
.
sin
(
theta
)
#acceleration of bubbles
self
.
ax
=
np
.
random
.
normal
(
0
,
self
.
sigmaa
,[
num
])
self
.
ay
=
np
.
random
.
normal
(
0
,
self
.
sigmaa
,[
num
])
#complex amplitude of bubbles
self
.
A
=
np
.
random
.
normal
(
0
,
self
.
sigmaA
,[
num
])
+
1j
*
np
.
random
.
normal
(
0
,
self
.
sigmaA
,[
num
])
#self.A=np.abs(self. A)*np.exp(1j*np.random.normal(0,self.sdv_phib,[num])*np.pi/180)
def
refresh
(
self
):
"""
Change the location, velocity, acceleration and Complex Amplitude of bubbles,
delete the bubbles that are out of the zone, give birth to new bubbles and vanish
part of the old bubbles
"""
#refresh location
self
.
x
=
self
.
x
+
self
.
vx
*
self
.
dt
self
.
y
=
self
.
y
+
self
.
vy
*
self
.
dt
#refresh velocity
self
.
vx
=
self
.
vx
+
self
.
ax
*
self
.
dt
self
.
vy
=
self
.
vy
+
self
.
ay
*
self
.
dt
direct
=
np
.
random
.
uniform
(
-
30
,
30
,
self
.
vx
.
shape
)
*
np
.
pi
/
180
self
.
vx
=
self
.
vx
*
np
.
cos
(
direct
)
-
self
.
vy
*
np
.
sin
(
direct
)
self
.
vy
=
self
.
vx
*
np
.
sin
(
direct
)
+
self
.
vy
*
np
.
cos
(
direct
)
#refresh acceleration
self
.
ax
=
np
.
random
.
normal
(
0
,
self
.
sigmaa
,
self
.
x
.
shape
)
self
.
ay
=
np
.
random
.
normal
(
0
,
self
.
sigmaa
,
self
.
x
.
shape
)
#refresh amplitude
AM
=
np
.
random
.
uniform
(
1
-
self
.
bubbleAM
,
1
+
self
.
bubbleAM
,
self
.
A
.
shape
)
self
.
A
*=
AM
#delete the bubbles that are out of the zone
flag1
=
np
.
bitwise_and
(
self
.
x
>=
self
.
xrange
[
0
],
self
.
x
<=
self
.
xrange
[
1
])
flag2
=
np
.
bitwise_and
(
self
.
y
>=
self
.
yrange
[
0
],
self
.
y
<=
self
.
yrange
[
1
])
flag
=
np
.
bitwise_and
(
flag1
,
flag2
)
self
.
x
=
self
.
x
[
flag
]
self
.
y
=
self
.
y
[
flag
]
self
.
vx
=
self
.
vx
[
flag
]
self
.
vy
=
self
.
vy
[
flag
]
self
.
ax
=
self
.
ax
[
flag
]
self
.
ay
=
self
.
ay
[
flag
]
self
.
A
=
self
.
A
[
flag
]
def
image
(
self
):
locx
=
np
.
round
(
self
.
x
/
self
.
pixel
[
0
]).
astype
(
np
.
int
)
locy
=
np
.
round
(
self
.
y
/
self
.
pixel
[
1
]).
astype
(
np
.
int
)
B
=
np
.
zeros
(
self
.
shape
,
dtype
=
np
.
complex128
)
B
[
tuple
(
locy
),
tuple
(
locx
)]
=
self
.
A
return
B
\ No newline at end of file
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