def test_shapes_nfields(num, example_grid): """test single component field""" fields = [ScalarField.random_uniform(example_grid) for _ in range(num)] field = FieldCollection(fields) data_shape = (num, ) + example_grid.shape np.testing.assert_equal(field.data.shape, data_shape) for pf_single in field: np.testing.assert_equal(pf_single.data.shape, example_grid.shape) field_c = field.copy() np.testing.assert_allclose(field.data, field_c.data) assert field.grid == field_c.grid
def test_kymograph_collection(tmp_path): """ test making kymographs for field collections """ # create some storage field = FieldCollection([ ScalarField(UnitGrid(8), label="a"), ScalarField(UnitGrid(8), label="b") ]) with get_memory_storage(field) as storage: for i in range(8): storage.append(field.copy(data=i), i) # create single kymograph path = tmp_path / "test1.png" plotting.plot_kymograph(storage, field_index=1, colorbar=True, transpose=True, filename=path) assert path.stat().st_size > 0 # create multiple kymographs path = tmp_path / "test2.png" plotting.plot_kymographs(storage, filename=path) assert path.stat().st_size > 0