Skip to content

Validator

Connection

Bases: Base

A single connection between two cells.

Parameters:

Name Type Description Default
pre

The pre-synaptic cell

required
post

The post-synaptic cell

required
weight

The weight of the connection, which could be the number of synapses or a normalized value.

required
Source code in cect/validation/Validator.py
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@modelspec.define
class Connection(Base):
    """
    A single connection between two cells.

    Args:
        pre: The pre-synaptic cell
        post: The post-synaptic cell
        weight: The weight of the connection, which could be the number of synapses or a normalized value.
    """

    pre: str = field(validator=instance_of(str))
    post: str = field(validator=instance_of(str))
    weight: float = field(validator=instance_of(float))

ConnectionList

Bases: Base

A model of a list of connections of a specific synapse type.

Parameters:

Name Type Description Default
synapse

The type of synapse

required
total_nonzero_conns

Total nonzero

required
comment

A comment about how the data was found, e.g. taken from a spreadsheet

required
connections

The list of connections of this type

required
Source code in cect/validation/Validator.py
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
@modelspec.define
class ConnectionList(Base):
    """
    A model of a list of connections of a specific synapse type.

    Args:
        synapse: The type of synapse
        total_nonzero_conns: Total nonzero
        comment: A comment about how the data was found, e.g. taken from a spreadsheet
        connections: The list of connections of this type
    """

    synapse: str = field(validator=instance_of(str))
    total_nonzero_conns: int = field(validator=instance_of(int))
    comment: str = field(validator=instance_of(str))
    connections: List[Connection] = field(factory=list)

ReaderExpectedData

Bases: Base

A model of expected data for a specific reader.

Parameters:

Name Type Description Default
reader

The name of the reader

required
connection_lists

The list of connection lists for this reader

required
Source code in cect/validation/Validator.py
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
@modelspec.define
class ReaderExpectedData(Base):
    """
    A model of expected data for a specific reader.

    Args:
        reader: The name of the reader
        connection_lists: The list of connection lists for this reader
    """

    reader: str = field(validator=instance_of(str))
    connection_lists: List[ConnectionList] = field(factory=list)

    def get_connection_list_by_synapse(self, synapse_type):
        """
        Get the connection list for a specific synapse type.

        Args:
            synapse_type: The type of synapse to get the connection list for


        Returns:            The connection list for the specified synapse type, or None if not found.
        """
        for conn_list in self.connection_lists:
            if (
                isinstance(conn_list, dict)
                and "synapse" in conn_list
                and conn_list["synapse"] == synapse_type
            ):
                return conn_list
            if conn_list.synapse == synapse_type:
                return conn_list
        return None

get_connection_list_by_synapse(synapse_type)

Get the connection list for a specific synapse type.

Parameters:

Name Type Description Default
synapse_type

The type of synapse to get the connection list for

required

Returns: The connection list for the specified synapse type, or None if not found.

Source code in cect/validation/Validator.py
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
def get_connection_list_by_synapse(self, synapse_type):
    """
    Get the connection list for a specific synapse type.

    Args:
        synapse_type: The type of synapse to get the connection list for


    Returns:            The connection list for the specified synapse type, or None if not found.
    """
    for conn_list in self.connection_lists:
        if (
            isinstance(conn_list, dict)
            and "synapse" in conn_list
            and conn_list["synapse"] == synapse_type
        ):
            return conn_list
        if conn_list.synapse == synapse_type:
            return conn_list
    return None

generate_reader_exp_data_obj(reader_name, source_files, additional_comment='')

A function to generate a ReaderExpectedData object which will list expected data as visually extracted from a source file, e.g. an Excel spreadsheet.

Parameters:

Name Type Description Default
reader_name

The name of the reader

required
source_files

A dict of syn types vs paths to the source files

required

Returns:

Type Description

A ReaderExpectedData object with the expected data for the reader.

Source code in cect/validation/Validator.py
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
def generate_reader_exp_data_obj(reader_name, source_files, additional_comment=""):
    """
    A function to generate a ReaderExpectedData object which will list expected data as visually extracted from a source file, e.g. an Excel spreadsheet.

    Args:
        reader_name: The name of the reader
        source_files: A dict of syn types vs paths to the source files

    Returns:
        A ReaderExpectedData object with the expected data for the reader.
    """
    # This is a placeholder implementation. In a real implementation, you would read the source files and extract the expected data.
    expected_data = ReaderExpectedData(reader=reader_name)

    for syn_class, source_file in source_files.items():
        chem_conns = ConnectionList(
            synapse=syn_class,
            comment=f"Data visually read in from {source_file}. {additional_comment}",
            total_nonzero_conns=-1,
        )

    expected_data.connection_lists.append(chem_conns)

    return expected_data