forked from OpenPTV/openptv
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Shakeb #11
Open
segalmax
wants to merge
9
commits into
yosefm:master
Choose a base branch
from
segalmax:shakeb
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Shakeb #11
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
46c3f48
shaking_par related changes, bindings and tests
4f74997
Rename of pyhton bindings tests module
8da0234
Add shaking parametrs tests.
c7f91db
Add testing_fodder to py_bind/test folder - this folder is identical …
32cb0e3
Restore the changes in parameters.pyx to MultimediaParams class.
794d950
remove commented out code, remove irrelevant comment
5c800a5
remove unnecessary files in py_bind/testing_fodder
segalmax 48e5f9d
remove MultimediaParams changes
segalmax ec66cc7
remove MultimediaParams changes, attempt 3
segalmax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
.project | ||
.pydevproject | ||
|
||
py_bind/optv/*.c | ||
|
||
*.pyc | ||
|
||
liboptv/config.h.in~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import unittest | ||
from optv.parameters import MultimediaParams, ShakingParams | ||
import numpy | ||
|
||
class Test_Parameters_binding(unittest.TestCase): | ||
def test_mm_np_instantiation(self): | ||
|
||
n2_np = numpy.array([11,22,33]) | ||
d_np = numpy.array([55,66,77]) | ||
|
||
m = MultimediaParams(nlay=3, n1=2, n2=n2_np, d=d_np, n3=4, lut=1) | ||
|
||
self.failUnlessEqual(m.get_nlay(), 3) | ||
self.failUnlessEqual(m.get_n1(), 2) | ||
self.failUnlessEqual(m.get_n3(), 4) | ||
self.failUnlessEqual(m.get_lut(), 1) | ||
|
||
numpy.testing.assert_array_equal(m.get_d(), d_np) | ||
numpy.testing.assert_array_equal(m.get_n2(), n2_np) | ||
|
||
self.failUnlessEqual(m.__str__(), "nlay=\t3 \nn1=\t2.0 \nn2=\t{11.0, 22.0, 33.0}" | ||
+ " \nd=\t{55.0, 66.0, 77.0} \nn3=\t4.0 \nlut=\t1 ") | ||
|
||
def test_shaking_par_instantiation(self): | ||
|
||
# manually assign values to ShakingParams object and check the assignments were made correctly | ||
sp1 = ShakingParams(222, 333, 444, 555) | ||
|
||
self.failUnlessEqual(sp1.get_seq_first(), 222) | ||
self.failUnlessEqual(sp1.get_seq_last(), 333) | ||
self.failUnlessEqual(sp1.get_max_shaking_points(), 444) | ||
self.failUnlessEqual(sp1.get_max_shaking_frames(), 555) | ||
|
||
# checking C read_shaking_par function | ||
# read shaking parameters from a file and | ||
# verify the parameters were read correctly according to contents of specified file | ||
sp1.read_shaking_par("testing_fodder/parameters/shaking.par") | ||
self.failUnlessEqual(sp1.get_seq_first(), 410000) | ||
self.failUnlessEqual(sp1.get_seq_last(), 411055) | ||
self.failUnlessEqual(sp1.get_max_shaking_points(), 100) | ||
self.failUnlessEqual(sp1.get_max_shaking_frames(), 3) | ||
|
||
# manually assigning values exactly like in the shaking parameters testing file | ||
# to another ShakingParams object | ||
sp2 = ShakingParams(410000, 411055, 100, 3) | ||
|
||
self.failUnlessEqual(sp2.get_seq_first(), 410000) | ||
self.failUnlessEqual(sp2.get_seq_last(), 411055) | ||
self.failUnlessEqual(sp2.get_max_shaking_points(), 100) | ||
self.failUnlessEqual(sp2.get_max_shaking_frames(), 3) | ||
|
||
# now we have two identical ShakingParams objects (sp1 and sp2) for comparison | ||
# PLEASE NOTE that Python will perform the comparison through function defined in ShakingParams class: | ||
# def __richcmp__ (ShakingParams self, ShakingParams other, operator): | ||
# The third parameter is an integer value to indicate the operation performed: 2 for '=' , 3 for '!=' (you must refer to them separately). | ||
# For more info: http://docs.cython.org/src/userguide/special_methods.html#rich-comparisons | ||
# So in order to check the comparisons '==' as well as '!=' must be passed: | ||
self.assertTrue(sp1==sp2) | ||
self.assertFalse(sp1!=sp2) | ||
|
||
#change one attribute in sp2 and assert the results of equality comparison are now inverted | ||
sp2.set_max_shaking_frames(-999) | ||
self.assertFalse(sp1==sp2) | ||
self.assertTrue(sp1!=sp2) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
410000 | ||
411055 | ||
100 | ||
3 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between this line and the one before? Same for the following occurrence on lines 59-60.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comparison is performed through function defined in ShakingParams:
The third parameter is integer value to indicate the operation performed: 2 for '=' , 3 for '!=' (you must refer to them separately).
For more info: http://docs.cython.org/src/userguide/special_methods.html#rich-comparisons
So in order to check the comparisons I must pass '==' as well as '!=' .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. This is not trivial, better add a comment explaining it.