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

Fixing #264: Raise exceptions on incommensurate times #265

Merged
merged 6 commits into from Mar 11, 2016

Conversation

@heplesser
Copy link
Contributor

heplesser commented Mar 8, 2016

Simulate now raises exception if simulation time is not multiple of the resolution. SetStatus on devices do the same if start, stop, origin are not multiples of the resolution. Some tests needed minor adaptation.

@jougs @apeyser Would you take a look?

…multiple of the resolution. SetStatus on devices do the same if start, stop, origin are not multiples of the resolution. Some tests needed minor adaptation.
@apeyser

This comment has been minimized.

Copy link

apeyser commented on nestkernel/device.cpp in 9b9153a Mar 8, 2016

Why the initialization? Isn't v just a temporary variable to reference times in a dictionary?

This comment has been minimized.

Copy link
Owner Author

heplesser replied Mar 10, 2016

@apeyser I guess it is not strictly necessary, and I added that while hunting a bug that had entirely different causes, but it does not hurt either, does it?

This comment has been minimized.

Copy link

apeyser replied Mar 10, 2016

@heplesser I guess it's a matter of taste. I took it as an indication that it was an input, when it's only an output variable, and hunted for where the initialization was necessary. If the following chunks are wrapped up into a convenience function, it goes away altogether.

@apeyser

This comment has been minimized.

Copy link

apeyser commented on nestkernel/device.cpp in 9b9153a Mar 8, 2016

Can't we wrap all the settings code into a local static function with three parameters, v, &timeref, name? The all look exactly the same to me.

@jougs
Copy link
Contributor

jougs commented Mar 8, 2016

I think the code is very nice. 👍 once Travis is also OK with it.

@apeyser

This comment has been minimized.

Copy link

apeyser commented on nestkernel/nest.cpp in 9b9153a Mar 8, 2016

Can this be infinite?

This comment has been minimized.

Copy link
Owner Author

heplesser replied Mar 11, 2016

I don't think you could enter infinity from SLI, but you could probably from Py, and we should avoid that. I will add addition tests, also against negative sim time.

@apeyser

This comment has been minimized.

Copy link

apeyser commented on testsuite/regressiontests/issue-264.sli in 9b9153a Mar 8, 2016

This should fail as long as TICS_PER_MS > 2, which is by default 1000. Should we comment or test this condition -- that it works when TICS_PER_MS >=2 ?

This comment has been minimized.

Copy link
Owner Author

heplesser replied Mar 11, 2016

The test value 1.5 should be exactly representable in tics, so we should require TICS_PER_MS to be a multiple of 2.

@apeyser

This comment has been minimized.

So this rounds down from stimtime + 2 ms to the nearest grid, correct? Shouldn't this round up to the nearest grid, or is the 2ms supposed to be large enough to always go to the next biggest grid time for all test cases, which is then sufficient for all spikes to arrive at spike detector? If it's the latter, it would probably be good to add a comment by the tested cases in the assert or die regarding what is the maximum testable case value (0.1? 0.2?)

@heplesser

This comment has been minimized.

Copy link
Owner Author

heplesser commented on 9b9153a Mar 8, 2016

@apeyser You are right, I hope the improvement I added right now addresses your concerns.

This comment has been minimized.

Copy link
Owner Author

heplesser replied Mar 11, 2016

@apeyser I just pushed several new commits that hopefully address your remaining concerns.

@apeyser

This comment has been minimized.

Invariants: simtime & res are floats (then it works correctly and the same for py2 & py3)

This comment has been minimized.

Copy link
Owner Author

heplesser replied Mar 11, 2016

I'll add explicit conversion to be safe.

@apeyser
Copy link
Contributor

apeyser commented Mar 11, 2016

👍 I'll merge after ci.

heplesser added a commit that referenced this pull request Mar 11, 2016
…check

Fixing #264: Raise exceptions on incommensurate times
@heplesser heplesser merged commit b7b1f97 into nest:master Mar 11, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@heplesser heplesser deleted the heplesser:fix264_incommensurate_simtime_check branch Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.