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

Add support for NEST circuits (and spikes visualization) #31

Merged
merged 2 commits into from
Oct 6, 2016
Merged

Conversation

favreau
Copy link
Member

@favreau favreau commented Sep 21, 2016

No description provided.

Copy link
Contributor

@jafyvilla jafyvilla left a comment

Choose a reason for hiding this comment

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

First round of comments...more are coming, but I think it's better to sit together and discuss.

@@ -101,6 +97,10 @@ void BraynsViewer::keypress(char key, const Vector2f& where)
BRAYNS_INFO << "Default renderer activated" << std::endl;
renderingParams.setRenderer("exobj");
break;
case '7':
Copy link
Contributor

Choose a reason for hiding this comment

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

We should start thinking about this hotkeys madness... soon we'll need bigger keyboards :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed! I think the nice way to do it is to create a 'key manager' than can be shared between the UI and Deflect so that we get the same interaction on all displays. TODO then ;-)

size_t ts = _brayns->getParametersManager().getSceneParameters().getTimestamp();
if( ts != std::numeric_limits<size_t>::max() )
float ts = _brayns->getParametersManager().getSceneParameters().getTimestamp();
if( ts != std::numeric_limits< float >::max() )
ss << " (frame " << ts << ")";
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it is a float now because it contains the actual timestamp instead of the frame number. If that's the case, the message should also be changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the timestamp as a float, rather than a frame as a int. In any simulation, what is interesting is the timestamp.

@@ -35,6 +35,7 @@ void FlyingModeManipulator::keypress( int32 key )
{
const float fwd = _window.getMotionSpeed();
viewport.translate( dir*fwd, true );
std::cout << viewport << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

💩

Copy link
Member Author

Choose a reason for hiding this comment

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

Ouch...

{
SceneParameters& sceneParameters =
_parametersManager->getSceneParameters();
const std::string& transferFunctionFilename =
sceneParameters.getTransferFunctionFilename();
if( !transferFunctionFilename.empty() )
{
TransferFunctionLoader transferFunctionLoader;
TransferFunctionLoader transferFunctionLoader(
brayns::Vector2f( -92.0915, 49.5497 ));
Copy link
Contributor

Choose a reason for hiding this comment

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

Magic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -94,7 +102,7 @@ class GeometryParameters : public AbstractParameters
float getRadiusMultiplier( ) const { return _radiusMultiplier; }

/** Radius correction applied to spheres and cylinders.
* @param value Radius value. The radius contained in the data source is
* @param value Radius vPARAM_SIMULATION_CACHE_FILENAMEalue. The radius contained in the data source is
Copy link
Contributor

Choose a reason for hiding this comment

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

👻

Copy link
Member Author

Choose a reason for hiding this comment

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

Wow...

@@ -731,35 +730,38 @@ void OSPRayScene::commitSimulationData()
const uint64_t frame = _sceneParameters.getTimestamp();
Copy link
Contributor

Choose a reason for hiding this comment

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

not float?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, float...

@@ -99,9 +102,15 @@ struct Brayns::Impl
{
GeometryParameters& geometryParameters =
_parametersManager->getGeometryParameters();
if(!geometryParameters.getSimulationCacheFile().empty())
Copy link
Contributor

@jafyvilla jafyvilla Sep 26, 2016

Choose a reason for hiding this comment

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

I just noticed that this is already checked inside the function, so we could remove it from here

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

if(!geometryParameters.getMorphologyFolder().empty())
_loadMorphologyFolder();

if(!geometryParameters.getNESTCircuit().empty())
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

if( !circuit.empty( ))
{
size_t nbMaterials;
NESTLoader* loader( new NESTLoader( geometryParameters ));
Copy link
Contributor

@jafyvilla jafyvilla Sep 26, 2016

Choose a reason for hiding this comment

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

Use a smart ptr here too? Same as others that are typedef'd

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, no need for a pointer at all... Removed it.

namespace zerobuf.data;

// Spikes activated for a given timestamp
table Spikes
Copy link
Contributor

Choose a reason for hiding this comment

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

Not used yet?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, but will eventually.

{
BRAYNS_PROGRESS( gid, _frameSize );
const size_t index =
int(xColor[gid]) + int(yColor[gid] * 256) + int(zColor[gid] * 65536);
Copy link
Contributor

Choose a reason for hiding this comment

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

explain why it's like that

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

for( size_t i = 0; i < _nbElements; ++i )
{
const float time = _values[ i ];
// whith the next check, simulation only plays forward
Copy link
Contributor

Choose a reason for hiding this comment

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

I did it like this so the loading could be faster, considering only timestamps bigger than current. But now you can only play the simulation forward. If that's ok it should be documented.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's go for the timestamp, that makes everything more consistent, externally and internally. Modifications done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I mean the if-clause at line 235. I added the if to spend less time reading the file, which I found slow. And if you keep it, it will only play the simulation nicely in one direction (forward).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I see what you mean. The only way to play the simulation backwards is to store the actual value of the spike intensity in the cache file itself, instead of computing it in the shader. Problem in doing this is that the speed of the decay will be stored in the cache file and cannot be changed at runtime. AFAIK, the simulation is always played forward. I suggest we keep the current implementation and document it. Ok with you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I don't see the need of playing backwards for now.


// we store the frame on which the spike happens, as the renderer keeps
// track of the current frame (not timestamp)
_spikingTimes[ gid ] = time / NEST_TIMESTEP;
Copy link
Contributor

Choose a reason for hiding this comment

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

Times or frames, up to you (I think I prefer frames internally). But it should be consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

* @param filename File containing the circuit
* @param scene Scene in which spheres should be added
*/
void importCircuit( const std::string& filename, Scene& scene, size_t& nbMaterials );
Copy link
Contributor

Choose a reason for hiding this comment

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

doxygen nbMaterials

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

* @param filename File containing the report
* @param scene Scene to which the simulation should be attached
*/
bool importSpikeReport( const std::string& filename, Scene& scene );
Copy link
Contributor

Choose a reason for hiding this comment

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

doxygen return

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -334,6 +367,30 @@ bool ZeroEQPlugin::_requestFrameBuffers()
return true;
}

bool ZeroEQPlugin::_requestSpikes()
{
BRAYNS_INFO << "Spikes requested" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wasn't aware this was already in place. Was it tested?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really for now. We need a data provider service that does not yet exist. Experimental for now.

@favreau
Copy link
Member Author

favreau commented Oct 5, 2016

Retest this please

@favreau favreau force-pushed the spikes branch 2 times, most recently from 5c190ad to 3f54e65 Compare October 5, 2016 14:51
Conflicts:
	brayns/io/MorphologyLoader.cpp
	tests/brayns.cpp
@jafyvilla jafyvilla merged commit 8e7bad2 into master Oct 6, 2016
@favreau favreau deleted the spikes branch October 6, 2016 13:22
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.

None yet

2 participants