Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

140 multiple outputs #311

Merged
merged 17 commits into from
Jul 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP: Remove memmap in more places
dfsp-spirit committed Jul 8, 2022
commit ce2ad9f79bfba0cf3081df5dfcda299901e75b88
6 changes: 2 additions & 4 deletions syncopy/datatype/discrete_data.py
Original file line number Diff line number Diff line change
@@ -475,8 +475,7 @@ def __init__(self,
ordered list of dimension labels
1. `filename` + `data` : create hdf dataset incl. sampleinfo @filename
2. `filename` no `data` : read from file or memmap (spy, hdf5, npy file
array -> memmap)
2. `filename` no `data` : read from file (spy, hdf5 file)
3. just `data` : try to attach data (error checking done by
:meth:`SpikeData.data.setter`)
@@ -594,8 +593,7 @@ def __init__(self,
ordered list of dimension labels
1. `filename` + `data` : create hdf dataset incl. sampleinfo @filename
2. `filename` no `data` : read from file or memmap (spy, hdf5, npy file
array -> memmap)
2. `filename` no `data` : read from file(spy, hdf5)
3. just `data` : try to attach data (error checking done by
:meth:`EventData.data.setter`)
25 changes: 1 addition & 24 deletions syncopy/tests/test_specest.py
Original file line number Diff line number Diff line change
@@ -4,16 +4,12 @@
#

# Builtin/3rd party package imports
import os
import tempfile
import inspect
import random
import psutil
import gc
import pytest
import numpy as np
import scipy.signal as scisig
from numpy.lib.format import open_memmap
from syncopy import __acme__
if __acme__:
import dask.distributed as dd
@@ -22,7 +18,7 @@
from syncopy.tests.misc import generate_artificial_data, flush_local_cluster
from syncopy import freqanalysis
from syncopy.shared.errors import SPYValueError
from syncopy.datatype.base_data import VirtualData, Selector
from syncopy.datatype.base_data import Selector
from syncopy.datatype import AnalogData, SpectralData
from syncopy.shared.tools import StructDict, get_defaults

@@ -369,25 +365,6 @@ def test_dpss(self):
assert np.max(spec.freq - freqs) < self.ftol
assert spec.taper.size == 1


@pytest.mark.skip(reason="VirtualData is currently not supported")
def test_vdata(self):
# test constant padding w/`VirtualData` objects (trials have identical lengths)
with tempfile.TemporaryDirectory() as tdir:
npad = 10
fname = os.path.join(tdir, "dummy.npy")
np.save(fname, self.sig)
dmap = open_memmap(fname, mode="r")
vdata = VirtualData([dmap, dmap])
avdata = AnalogData(vdata, samplerate=self.fs,
trialdefinition=self.trialdefinition)
spec = freqanalysis(avdata, method="mtmfft",
tapsmofrq=3, keeptapers=False, output="abs", pad="relative",
padlength=npad)
assert (np.diff(avdata.sampleinfo)[0][0] + npad) / 2 + 1 == spec.freq.size
del avdata, vdata, dmap, spec
gc.collect() # force-garbage-collect object so that tempdir can be closed

@skip_without_acme
@skip_low_mem
def test_parallel(self, testcluster):
20 changes: 0 additions & 20 deletions syncopy/tests/test_spyio.py
Original file line number Diff line number Diff line change
@@ -11,9 +11,7 @@
import time
import pytest
import numpy as np
from numpy.lib.format import open_memmap
from glob import glob
from memory_profiler import memory_usage

# Local imports
from syncopy.datatype import AnalogData
@@ -446,24 +444,6 @@ def test_multi_saveload(self):
load(os.path.join(tdir, container), dataclass=["invalid", "stillinvalid"],
tag="2nd")

def test_save_mmap(self):
with tempfile.TemporaryDirectory() as tdir:
fname = os.path.join(tdir, "vdat.npy")
dname = os.path.join(tdir, "dummy")
vdata = np.ones((1000, 5000)) # ca. 38.2 MB
np.save(fname, vdata)
del vdata
dmap = open_memmap(fname)
adata = AnalogData(dmap, samplerate=10)

# Ensure memory consumption stays within provided bounds
mem = memory_usage()[0]
save(adata, filename=dname, memuse=60)
assert (mem - memory_usage()[0]) < 70

# Delete all open references to file objects b4 closing tmp dir
del dmap, adata


@skip_no_esi
class Test_FT_Importer: