neurolang.utils.server.engines module

class neurolang.utils.server.engines.DestrieuxEngineConf(data_dir: Path, resolution: int | None = None)

Bases: NeurolangEngineConfiguration

Attributes:
atlas
key

Methods

create

property atlas
create() NeurolangPDL
property key
class neurolang.utils.server.engines.NeurolangEngineConfiguration

Bases: object

A NeurolangEngineConfiguration is a combination of an id key and a method which returns a Neurolang instance.

Attributes:
atlas
key

Methods

create

abstract property atlas
abstract create() NeurolangDL | NeurolangPDL
abstract property key
class neurolang.utils.server.engines.NeurolangEngineSet(engine: NeurolangDL | NeurolangPDL)

Bases: object

Utility class to hold a set of Neurolang engines (either NeurolangDL or NeurolangPDL). It keeps track of the total number of engines added to the set, as well as a semaphore to manage acquiring and releasing the engines in a safe concurrent manner.

Methods

add_engine(engine)

Add an engine to the set and increase the total number of engines in the set.

engine([timeout])

ContextManager to safely acquire an engine from the set.

add_engine(engine: NeurolangDL | NeurolangPDL) None

Add an engine to the set and increase the total number of engines in the set.

Parameters:
engineUnion[NeurolangDL, NeurolangPDL]

the engine to add.

engine(timeout: int = None)

ContextManager to safely acquire an engine from the set. This method will block on the semaphore until an engine can be safely used from this set, and then yield it. At the end, the engine is put back in the set and the semaphore value is released.

Parameters:
timoutint

When invoked with a timeout other than None, it will block for at most timeout seconds.

Yields:
Union[NeurolangDL, NeurolangPDL]

an engine.

class neurolang.utils.server.engines.NeurosynthEngineConf(data_dir: Path, resolution=None)

Bases: NeurolangEngineConfiguration

Attributes:
atlas
brain_mask
key

Methods

create

property atlas
property brain_mask
create() NeurolangPDL
property key
neurolang.utils.server.engines.add_ploting_functions(nl: NeurolangDL | NeurolangPDL)
neurolang.utils.server.engines.init_frontend(mni_mask)

Create a Neurolang Probabilistic engine and add some aggregation methods.

Returns:
NeurolangPDL

the Neurolang engine

neurolang.utils.server.engines.load_destrieux_atlas(data_dir, nl)
neurolang.utils.server.engines.load_neurosynth_data(data_dir: Path, nl, mni_mask: Nifti1Image)