Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
empyre
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
Container 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Teresa Weßels
empyre
Commits
81ce0fe6
Commit
81ce0fe6
authored
4 years ago
by
Jan Caron
Browse files
Options
Downloads
Patches
Plain Diff
Changed default behaviouf of create_vector_homog
3D now always has 3 components, 2D only if theta is specified!
parent
7091c5dd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/empyre/fields/vectors.py
+4
-2
4 additions, 2 deletions
src/empyre/fields/vectors.py
with
4 additions
and
2 deletions
src/empyre/fields/vectors.py
+
4
−
2
View file @
81ce0fe6
...
...
@@ -37,11 +37,13 @@ def create_vector_homog(dim, phi=0, theta=None, scale=1.0):
assert
len
(
dim
)
in
(
2
,
3
),
'
Disc can only be build in 2 or 3 dimensions!
'
assert
isinstance
(
phi
,
Number
),
'
phi has to be an angle in radians!
'
assert
isinstance
(
theta
,
Number
)
or
theta
is
None
,
'
theta has to be an angle in radians or None!
'
if
theta
is
None
:
if
len
(
dim
)
==
2
and
theta
is
None
:
# 2D and 3rd component not explicitely wanted
:
y_comp
=
np
.
ones
(
dim
)
*
np
.
sin
(
phi
)
x_comp
=
np
.
ones
(
dim
)
*
np
.
cos
(
phi
)
data
=
np
.
stack
([
x_comp
,
y_comp
],
axis
=-
1
)
else
:
else
:
# 3D, always have a third component:
if
theta
is
None
:
theta
=
np
.
pi
/
2
# xy-plane if not specified otherwise!
z_comp
=
np
.
ones
(
dim
)
*
np
.
cos
(
theta
)
y_comp
=
np
.
ones
(
dim
)
*
np
.
sin
(
theta
)
*
np
.
sin
(
phi
)
x_comp
=
np
.
ones
(
dim
)
*
np
.
sin
(
theta
)
*
np
.
cos
(
phi
)
...
...
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