Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LISA Instrument
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LISA Simulation
LISA Instrument
Merge requests
!46
Draft: Resolve "Use Numpy arrays instead of `ForEachObject` instances"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Draft: Resolve "Use Numpy arrays instead of `ForEachObject` instances"
34-use-numpy-arrays-instead-of-foreachobject-instances
into
master
Overview
7
Commits
3
Pipelines
10
Changes
2
2 unresolved threads
Hide all comments
Closed
Jean-Baptiste Bayle
requested to merge
34-use-numpy-arrays-instead-of-foreachobject-instances
into
master
3 years ago
Overview
7
Commits
3
Pipelines
10
Changes
2
2 unresolved threads
Hide all comments
Expand
Closes
#34 (closed)
0
0
Merge request reports
Compare
version 1
version 8
6d09ccff
3 years ago
version 7
6d09ccff
3 years ago
version 6
2dc661bc
3 years ago
version 5
02d1166a
3 years ago
version 4
405d0ba0
3 years ago
version 3
7c1b4e41
3 years ago
version 2
4d49f9bb
3 years ago
version 1
d86decb0
3 years ago
master (base)
and
version 2
latest version
e08d1b90
3 commits,
2 years ago
version 8
6d09ccff
3 commits,
3 years ago
version 7
6d09ccff
3 commits,
3 years ago
version 6
2dc661bc
1 commit,
3 years ago
version 5
02d1166a
1 commit,
3 years ago
version 4
405d0ba0
9 commits,
3 years ago
version 3
7c1b4e41
8 commits,
3 years ago
version 2
4d49f9bb
7 commits,
3 years ago
version 1
d86decb0
6 commits,
3 years ago
Show latest version
2 files
+
159
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
lisainstrument/indexing.py
+
104
−
0
Options
@@ -285,3 +285,107 @@ def mosa2adjacent(x):
raise
IndexError
(
f
"
invalid MOSA index
'
{
index
}
'"
)
# Transform index
return
ADJACENT_MOSAS
[
mosa2index
(
x
)]
def
empty_mosa
(
shape
,
*
args
,
**
kwargs
):
"""
Return a new MOSA array of given shape and type, without initializing entries.
Returns:
MOSA array of shape (6, shape).
"""
if
isinstance
(
shape
,
int
):
shape
=
(
6
,
shape
)
else
:
shape
=
(
6
,
*
shape
)
return
np
.
empty
(
shape
,
*
args
,
**
kwargs
)
def
empty_sc
(
shape
,
*
args
,
**
kwargs
):
"""
Return a new SC array of given shape and type, without initializing entries.
Returns:
SC array of shape (3, shape).
"""
if
isinstance
(
shape
,
int
):
shape
=
(
3
,
shape
)
else
:
shape
=
(
3
,
*
shape
)
return
np
.
empty
(
shape
,
*
args
,
**
kwargs
)
def
ones_mosa
(
shape
,
*
args
,
**
kwargs
):
"""
Return a new MOSA array of given shape and type, filled with ones.
Returns:
MOSA array of shape (6, shape).
"""
if
isinstance
(
shape
,
int
):
shape
=
(
6
,
shape
)
else
:
shape
=
(
6
,
*
shape
)
return
np
.
ones
(
shape
,
*
args
,
**
kwargs
)
def
ones_sc
(
shape
,
*
args
,
**
kwargs
):
"""
Return a new SC array of given shape and type, filled with ones.
Returns:
SC array of shape (3, shape).
"""
if
isinstance
(
shape
,
int
):
shape
=
(
3
,
shape
)
else
:
shape
=
(
3
,
*
shape
)
return
np
.
ones
(
shape
,
*
args
,
**
kwargs
)
def
zeros_mosa
(
shape
,
*
args
,
**
kwargs
):
"""
Return a new MOSA array of given shape and type, filled with zeros.
Returns:
MOSA array of shape (6, shape).
"""
if
isinstance
(
shape
,
int
):
shape
=
(
6
,
shape
)
else
:
shape
=
(
6
,
*
shape
)
return
np
.
zeros
(
shape
,
*
args
,
**
kwargs
)
def
zeros_sc
(
shape
,
*
args
,
**
kwargs
):
"""
Return a new SC array of given shape and type, filled with zeros.
Returns:
SC array of shape (3, shape).
"""
if
isinstance
(
shape
,
int
):
shape
=
(
3
,
shape
)
else
:
shape
=
(
3
,
*
shape
)
return
np
.
zeros
(
shape
,
*
args
,
**
kwargs
)
def
full_mosa
(
shape
,
fill_value
,
*
args
,
**
kwargs
):
"""
Return a new MOSA array of given shape and type, filled with `fill_value`.
Returns:
MOSA array of shape (6, shape).
"""
if
isinstance
(
shape
,
int
):
shape
=
(
6
,
shape
)
else
:
shape
=
(
6
,
*
shape
)
return
np
.
full
(
shape
,
fill_value
,
*
args
,
**
kwargs
)
def
full_sc
(
shape
,
fill_value
,
*
args
,
**
kwargs
):
"""
Return a new SC array of given shape and type, filled with `fill_value`.
Returns:
SC array of shape (3, shape).
"""
if
isinstance
(
shape
,
int
):
shape
=
(
3
,
shape
)
else
:
shape
=
(
3
,
*
shape
)
return
np
.
full
(
shape
,
fill_value
,
*
args
,
**
kwargs
)
Loading