Beispiel #1
0
    def test_NodeSet_toJSON(self):
        j = '''
        {"bio_layer45": {
              "model_type": "biophysical",
              "location": ["layer4", "layer5"]
          },
          "V1_point_prime": {
              "population": "biophysical",
              "model_type": "point",
              "node_id": [1, 2, 3, 5, 7, 9]
          },
          "power_number_test": {
              "numeric_attribute_gt": { "$gt": 3 },
              "numeric_attribute_lt": { "$lt": 3 },
              "numeric_attribute_gte": { "$gte": 3 },
              "numeric_attribute_lte": { "$lte": 3 }
          },
          "power_regex_test": {
              "string_attr": { "$regex": "^[s][o]me value$" }
          },
          "combined": ["bio_layer45", "V1_point_prime"]
        }'''
        new = NodeSets(j).toJSON()
        ns1 = NodeSets(new)
        self.assertEqual(new, ns1.toJSON())

        ns = NodeSets.from_file(os.path.join(PATH, 'node_sets.json'))
        self.assertEqual(new, ns.toJSON())
Beispiel #2
0
def test_path_ctor():
    #  make sure constructors that take file paths can use pathlib.Path
    path = pathlib.Path(PATH)

    NodeStorage(path / 'nodes1.h5')
    EdgeStorage(path / 'edges1.h5')
    SpikeReader(path / 'spikes.h5')
    SomaReportReader(path / 'somas.h5')
    ElementReportReader(path / 'elements.h5')
    NodeSets.from_file(path / 'node_sets.json')
    CircuitConfig.from_file(path / 'config/circuit_config.json')
Beispiel #3
0
    def test_BasicScalarPopulation(self):
        sel = NodeSets(
            '{ "NodeSet0": { "population": "nodes-A" } }').materialize(
                "NodeSet0", self.population)
        self.assertEqual(sel, self.population.select_all())

        sel = NodeSets('{ "NodeSet0": { "population": ["nodes-A",  "FAKE"] } }'
                       ).materialize("NodeSet0", self.population)
        self.assertEqual(sel, self.population.select_all())

        sel = NodeSets(
            '{ "NodeSet0": { "population": "NOT_A_POP" } }').materialize(
                "NodeSet0", self.population)
        self.assertEqual(sel, Selection([]))
Beispiel #4
0
 def test_BasicScalarAnded(self):
     j = '''{"NodeSet0": {"E-mapping-good": "C",
                          "attr-Y": [21, 22]
                         }
         }'''
     sel = NodeSets(j).materialize("NodeSet0", self.population)
     self.assertEqual(sel, Selection(((0, 1), )))
Beispiel #5
0
 def test_NodeSetCompound(self):
     j = '''{"NodeSet0": { "node_id": [1] },
             "NodeSet1": { "node_id": [2] },
             "NodeSetCompound0": ["NodeSet0", "NodeSet1"],
             "NodeSetCompound1": ["NodeSetCompound0", "NodeSet2"],
             "NodeSet2": { "node_id": [3] }
     }'''
     sel = NodeSets(j).materialize("NodeSetCompound1", self.population)
     self.assertEqual(sel, Selection(((1, 4), )))
Beispiel #6
0
 def test_BasicScalarEnum(self):
     sel = NodeSets(
         '{ "NodeSet0": { "E-mapping-good": "C" } }').materialize(
             "NodeSet0", self.population)
     self.assertEqual(sel, Selection((
         (0, 1),
         (2, 3),
         (4, 6),
     )))
Beispiel #7
0
    def test_NodeSet_toJSON(self):
        j = '''
        {"bio_layer45": {
              "model_type": "biophysical",
              "location": ["layer4", "layer5"]
          },
          "V1_point_prime": {
              "population": "biophysical",
              "model_type": "point",
              "node_id": [1, 2, 3, 5, 7, 9]
          },
          "combined": ["bio_layer45", "V1_point_prime"]
        }'''
        new = NodeSets(j).toJSON()
        ns1 = NodeSets(new)
        self.assertEqual(new, ns1.toJSON())

        ns = NodeSets.from_file(os.path.join(PATH, 'node_sets.json'))
        self.assertEqual(new, ns.toJSON())
Beispiel #8
0
 def test_BasicScalarNodeId(self):
     sel = NodeSets('{ "NodeSet0": { "node_id": [1, 3, 5] } }').materialize(
         "NodeSet0", self.population)
     self.assertEqual(sel, Selection(((1, 2), (3, 4), (5, 6))))
Beispiel #9
0
 def test_BasicScalarString(self):
     sel = NodeSets(
         '{ "NodeSet0": { "attr-Z": ["aa", "cc"] } }').materialize(
             "NodeSet0", self.population)
     self.assertEqual(sel, Selection(((0, 1), (2, 3))))
Beispiel #10
0
 def test_BasicScalarInt(self):
     sel = NodeSets('{ "NodeSet0": { "attr-Y": 21 } }').materialize(
         "NodeSet0", self.population)
     self.assertEqual(sel, Selection(((0, 1), )))