Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docu: examples for sfs.array #97

Merged
merged 1 commit into from
Mar 11, 2019
Merged

docu: examples for sfs.array #97

merged 1 commit into from
Mar 11, 2019

Conversation

fs446
Copy link
Member

@fs446 fs446 commented Feb 28, 2019

added examples for array functions
need further changes when loudspeaker_2d,_3d handling is optimized
please double check the bugfix in planar() where N1 and N2 were exchanged

Copy link
Member

@mgeier mgeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO the file names of the two new files are not great.

Could you probably choose something a bit more descriptive?

sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
fs446 added a commit that referenced this pull request Mar 1, 2019
@fs446
Copy link
Member Author

fs446 commented Mar 1, 2019

IMHO the file names of the two new files are not great.

Could you probably choose something a bit more descriptive?

changed to
example_array_4LS_2D.csv
example_array_6LS_3D.txt

@fs446
Copy link
Member Author

fs446 commented Mar 1, 2019

please double check changing rostock array data:
2599600

Copy link
Member

@mgeier mgeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changing the file names, they are much better now.

Could you please make sure to squash your commits at some point in order to remove the temporarily commited .rst files from the Git history?

sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Show resolved Hide resolved
sfs/array.py Show resolved Hide resolved
sfs/array.py Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
@mgeier
Copy link
Member

mgeier commented Mar 2, 2019

please double check the bugfix in planar() where N1 and N2 were exchanged

AFAICT this was not a bug.

The words "horizontal" and "vertical" in the docstring refer to the array's default orientation=[1, 0, 0].

With your "fix" the behavior is reversed with regards to the description.

@fs446
Copy link
Member Author

fs446 commented Mar 4, 2019

please double check the bugfix in planar() where N1 and N2 were exchanged

AFAICT this was not a bug.

The words "horizontal" and "vertical" in the docstring refer to the array's default orientation=[1, 0, 0].

With your "fix" the behavior is reversed with regards to the description.

I double checked what's going on. In fact neither the original version as well as the "bugfix" solving the problem in a consistent way, both sometimes are correct and sometimes not in terms of math. For orientation = (0,0,1) the fixed version is doing what the user might expect from the given documentation, that is the current example. However, we need to fix this for proper and general handling. I'd suggest:
In order to define a plane discretized with du and dv we could define this plane with the two orthogonal! vectors u and v (u dot v = 0) and calculate the resulting normal vector n = u cross v. N1 and N2 then belong to u and v, respectively and consistently should be renamed to Nu and Nv (or whatever two letters we use later for denotation). The function call then might read as

planar((u,v), (Nu,Nv), (du,dv), center=[0, 0, 0])

which is mathematically consistent. Problem here is that u and v must be orthogonal, since remaining calculations rely on that assumption. However, this appears to be the best handling rather than others that involve additional rotation/looking direction information when using only u.

In order for simple and fast usage we should think about very often used defaults, such as 'xy', 'yz', 'zx' planes with normals (i) into the remaining cartesian axis or (ii) flipped (equivalent to 'yx', 'zy', 'xz'-planes). I don't know what the most elegant handling would be.

@mgeier
Copy link
Member

mgeier commented Mar 6, 2019

@fs446 Can you please remove your "fix" from this PR and create a new issue (and/or PR if you want) for the issue you described above?

fs446 added a commit that referenced this pull request Mar 6, 2019
#97 (comment)
#97 (comment)

I find this more meaningful:
This fixes planar() such that the docstring comment for the horizontal/vertical dimension intuitively make sense for the xy-plane rather than the original planar() before raising issue #97, there the yz-plane was chose, where definition is ambigious
@fs446
Copy link
Member Author

fs446 commented Mar 6, 2019 via email

sfs/array.py Show resolved Hide resolved
sfs/array.py Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
@mgeier
Copy link
Member

mgeier commented Mar 7, 2019

Now that pycodestyle is satisfied, the next step is:

$ python3 -m pydocstyle sfs/array.py 
[...]
sfs/array.py:244 in public function `rounded_edge`:
        D205: 1 blank line required between summary line and description (found 0)
sfs/array.py:244 in public function `rounded_edge`:
        D400: First line should end with a period (not 'd')
sfs/array.py:319 in public function `edge`:
        D205: 1 blank line required between summary line and description (found 0)
sfs/array.py:319 in public function `edge`:
        D400: First line should end with a period (not 'p')

See also https://www.python.org/dev/peps/pep-0257/.

@mgeier
Copy link
Member

mgeier commented Mar 7, 2019

@fs446:

could do this, but I'd vote for de29425

I'd vote against, because this doesn't make sense given the current text in the docstring:

If a pair of numbers is given, the first one specifies the number on the horizontal edge, the second one specifies the number on the vertical edge.

If orientation=[0, 0, 1] is given, there is no vertical edge, there are only two horizontal edges!

I guess we have different understanding of the words "orientation" and/or "edge" and/or "vertical" and/or "horizontal". Or probably "x", "y" and "z"?

Just to be clear: "horizontal" means for me: any direction that has a zero z-component, i.e. [x, y, 0]. "vertical" means for me: the direction that has only a z-component, i.e. [0, 0, z].

Linear arrays are by default "horizontal", so are rectangular and circular ones (which I guess is the typical use case).

The orientation in the sfs.array module so far has meant the orientation of the loudspeakers themselves (or one reference loudspeaker in case they have different orientations), not necessarily the lines or planes or whatever they are on.

Planar arrays should IMHO have a default primary radiation direction that is horizontal (which is the main thing I've seen on real loudspeaker arrays so far).
Your suggestion orientation=[0, 0, 1] would mean that the main radiation direction would be up to the ceiling.

I agree that there is a problem with the orientation of arrays (in contrast to assumed rotational-symmetric-along-their-main-axis single loudspeakers) because when only providing one orientation vector, one degree of freedom stays undefined. That's why I opened #36.
Currently, the rotations are still well-defined (except probably orientation=[-1, 0, 0]?), but the chosen rotation might not be obvious.
And what's probably worse, it's not possible to get to all possible rotations.
You might have to do a second (and third?) rotation to get to an arbitrary orientation.

both sometimes are correct and sometimes not in terms of math.

For the version before your changes, do you mean the case orientation=[-1, 0, 0]?
Or some other cases?

planar((u,v), (Nu,Nv), (du,dv), center=[0, 0, 0])

This sounds overly complicated, but more importantly it's not consistent with the current API of linear() and the other functions in the module.
How would you extend those to become consistent?

In order for simple and fast usage we should think about very often used defaults, such as 'xy', 'yz', 'zx' planes with normals (i) into the remaining cartesian axis or (ii) flipped (equivalent to 'yx', 'zy', 'xz'-planes). I don't know what the most elegant handling would be.

Probably it would be enough to provide a list of example invocations in the documentation?

@fs446
Copy link
Member Author

fs446 commented Mar 7, 2019 via email

@fs446 fs446 force-pushed the array_docu branch 4 times, most recently from b035e3f to 699be57 Compare March 7, 2019 22:10
@fs446
Copy link
Member Author

fs446 commented Mar 7, 2019

ready for master?

@mgeier
Copy link
Member

mgeier commented Mar 8, 2019

We are very close.

This is still not addressed: #97 (comment).

sfs/array.py Outdated Show resolved Hide resolved
sfs/array.py Outdated Show resolved Hide resolved
-Old "university_rostock.csv" as of 2015 is "wfs_university_rostock_2015.csv"
now. New measurement data of december 2018 is stored in
"wfs_university_rostock_2018" and now includes absolute height (z coordinate,
KH120 logo) and weights of the 64 loudspeakers.
@mgeier mgeier merged commit 8bb6387 into master Mar 11, 2019
@mgeier mgeier deleted the array_docu branch March 11, 2019 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants