GT#

Interface to read and write graph tool files.

Note

The module utilizes the gt writer/reader from graph_tool.

See also

:mod`ClearMap.Analysis.Graphs`

class Source(location=None, graph=None, name=None)[source]#

Bases: Source

GT graph source.

as_real()[source]#
as_virtual()[source]#

Return virtual source without array data to pass in parallel processing.

Returns

sourceSource class

The source class without array data.

copy()[source]#
info()[source]#
read(location=None)[source]#
write(location=None)[source]#
property graph#

The underlying graph.

Returns

graphGraph

The underlying graph of this source.

property location#

The location where the data of the source is stored.

Returns

locationstr or None

Returns the location of the data source or None if this source lives in memory only.

property name#

The name of this source.

Returns

namestr

Name of this source.

property shape#

The shape of the source.

Returns

shapetuple

The shape of the source.

class VirtualSource(source=None, location=None, name=None)[source]#

Bases: VirtualSource

as_real()[source]#
as_virtual()[source]#

Return virtual source without array data to pass in parallel processing.

Returns

sourceSource class

The source class without array data.

property graph#

The underlying graph.

Returns

graphGraph

The underlying graph of this source.

property name#

The name of this source.

Returns

namestr

Name of this source.

property shape#

The shape of the source.

Returns

shapetuple

The shape of the source.

create(location=None, **kwargs)[source]#
is_graph(source)[source]#

Checks if this source is a graph source

read(source, as_source=None, **kwargs)[source]#

Read graph from a file.

Arguments

sourcestr

The name of the graph file.

slicingslice, Slice or None

An optional sub-slice to consider.

as_sourcebool

If True, return results as a source.

Returns

graphGraph or Source

The graph as a Graph class or source.

test()[source]#

Test GT module

write(sink, graph, **kwargs)[source]#

Write graph to a file.

Arguments

sinkstr

The name of the CSV file.

graphGraph

The data to write into the CSV file.

Returns

sinkgrpah or source

The sink graph file.