I tried to run this 3 lines of Code:
import mne
myfile = 'test_raw.fif'
raw = mne.io.read_raw_fif(myfile)
It should load a .fif-File
Its the example from http://martinos.org/mne/stable/index.html
When I try it with their sample-Data it works! When I run it with my own recordet Data I get this Errorstack:
> runfile('C:/Felix/Uni/Bachelorarbeit/mne/untitled2.py',
> wdir='C:/Felix/Uni/Bachelorarbeit/mne') Opening raw data file
> C:\Felix\Uni\Bachelorarbeit\mne\test_raw.fif... Traceback (most recent
> call last): File "<stdin>", line 1, in <module> File
> "C:\Users\Felix\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py",
> line 866, in runfile
> execfile(filename, namespace) File "C:\Users\Felix\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py",
> line 87, in execfile
> exec(compile(scripttext, filename, 'exec'), glob, loc) File "C:/Felix/Uni/Bachelorarbeit/mne/untitled2.py", line 4, in <module>
> raw = mne.io.read_raw_fif(myfile) File "C:\Users\Felix\Anaconda2\lib\site-packages\mne\io\fiff\raw.py", line
> 519, in read_raw_fif
> add_eeg_ref=add_eeg_ref, fnames=fnames, verbose=verbose) File "<string>", line 2, in __init__ File
> "C:\Users\Felix\Anaconda2\lib\site-packages\mne\utils.py", line 708,
> in verbose
> return function(*args, **kwargs) File "C:\Users\Felix\Anaconda2\lib\site-packages\mne\io\fiff\raw.py", line
> 109, in __init__
> preload, do_check_fname) File "<string>", line 2, in _read_raw_file File "C:\Users\Felix\Anaconda2\lib\site-packages\mne\utils.py", line 708,
> in verbose
> return function(*args, **kwargs) File "C:\Users\Felix\Anaconda2\lib\site-packages\mne\io\fiff\raw.py", line
> 186, in _read_raw_file
> ff, tree, _ = fiff_open(fname, preload=whole_file) File "<string>", line 2, in fiff_open File
> "C:\Users\Felix\Anaconda2\lib\site-packages\mne\utils.py", line 708,
> in verbose
> return function(*args, **kwargs) File "C:\Users\Felix\Anaconda2\lib\site-packages\mne\io\open.py", line 146,
> in fiff_open
> tree, _ = make_dir_tree(fid, directory) File "<string>", line 2, in make_dir_tree File
> "C:\Users\Felix\Anaconda2\lib\site-packages\mne\utils.py", line 708,
> in verbose
> return function(*args, **kwargs) File "C:\Users\Felix\Anaconda2\lib\site-packages\mne\io\tree.py", line 56,
> in make_dir_tree
> if directory[start].kind == FIFF_BLOCK_START: TypeError: 'NoneType' object has no attribute '__getitem__'
I downloadet "brainstorm" wich can illustrate .fif-Files.
The Sampledate from MNE can be displayed. If I try mine, they wont.
:/
Related
It said that the file I referenced did not exist even though it was in the same directory. I do not understand what have gone wrong. Did it stop supporting the newest python?
import pyautogui
print("started")
time.sleep(3)
#hello = pyautogui.locateCenterOnScreen('TEST.png')
pyautogui.click('hello.png')```
```[ WARN:0#3.681] global /Users/xperience/actions-runner/_work/opencv-python/opencv-python/opencv/modules/imgcodecs/src/loadsave.cpp (239) findDecoder imread_('hello.png'): can't open/read file: check file path/integrity
Traceback (most recent call last):
File "/Users/andrewzhuang/Programming/Python/Autogrinder/Autogrind Advanced.py", line 10, in <module>
pyautogui.click('hello.png')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyautogui/__init__.py", line 598, in wrapper
returnVal = wrappedFunction(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyautogui/__init__.py", line 980, in click
x, y = _normalizeXYArgs(x, y)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyautogui/__init__.py", line 661, in _normalizeXYArgs
location = locateOnScreen(firstArg)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyautogui/__init__.py", line 175, in wrapper
return wrappedFunction(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyautogui/__init__.py", line 213, in locateOnScreen
return pyscreeze.locateOnScreen(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyscreeze/__init__.py", line 373, in locateOnScreen
retVal = locate(image, screenshotIm, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyscreeze/__init__.py", line 353, in locate
points = tuple(locateAll(needleImage, haystackImage, **kwargs))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyscreeze/__init__.py", line 207, in _locateAll_opencv
needleImage = _load_cv2(needleImage, grayscale)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyscreeze/__init__.py", line 170, in _load_cv2
raise IOError("Failed to read %s because file is missing, "
OSError: Failed to read hello.png because file is missing, has improper permissions, or is an unsupported or invalid format```
So I am currently working on a DNN that takes in m4a files. I have ffmpeg, it creates a few batches and then dies on this error:
Traceback (most recent call last):
File "/users/work/s163838/./main.py", line 126, in <module>
File "/users/work/s163838/./main.py", line 96, in main
print("e")
File "/apl/tryton/python/3.9.5/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
data = self._next_data()
File "/apl/tryton/python/3.9.5/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/apl/tryton/python/3.9.5/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
data.reraise()
File "/apl/tryton/python/3.9.5/lib/python3.9/site-packages/torch/_utils.py", line 425, in reraise
raise self.exc_type(msg)
EOFError: Caught EOFError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/librosa/core/audio.py", line 164, in load
y, sr_native = __soundfile_load(path, offset, duration, dtype)
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/librosa/core/audio.py", line 195, in __soundfile_load
context = sf.SoundFile(path)
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/soundfile.py", line 629, in __init__
self._file = self._open(file, mode_int, closefd)
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/soundfile.py", line 1183, in _open
_error_check(_snd.sf_error(file_ptr),
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/soundfile.py", line 1357, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening 'vox2/dev/aac/id08194/QnBYPze-x9A/00079.m4a': File contains data in an unknown format.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/apl/tryton/python/3.9.5/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/apl/tryton/python/3.9.5/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/apl/tryton/python/3.9.5/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/users/work/s163838/vox_celeb_loader.py", line 53, in __getitem__
load(speaker2utt1, self.num_samples)
File "/users/work/s163838/vox_celeb_loader.py", line 13, in load
wav, sr = librosa.load(path, sr=16000)
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/librosa/util/decorators.py", line 88, in inner_f
return f(*args, **kwargs)
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/librosa/core/audio.py", line 170, in load
y, sr_native = __audioread_load(path, offset, duration, dtype)
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/librosa/core/audio.py", line 226, in __audioread_load
reader = audioread.audio_open(path)
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/audioread/__init__.py", line 111, in audio_open
return BackendClass(path)
File "/users/kdm/s163838/.local/lib/python3.9/site-packages/audioread/rawread.py", line 65, in __init__
self._file = aifc.open(self._fh)
File "/apl/tryton/python/3.9.5/lib/python3.9/aifc.py", line 917, in open
return Aifc_read(f)
File "/apl/tryton/python/3.9.5/lib/python3.9/aifc.py", line 358, in __init__
self.initfp(f)
File "/apl/tryton/python/3.9.5/lib/python3.9/aifc.py", line 314, in initfp
chunk = Chunk(file)
File "/apl/tryton/python/3.9.5/lib/python3.9/chunk.py", line 63, in __init__
raise EOFError
EOFError
I am using this command
wav, sr = librosa.load(path, sr=16000)
is it just a broken file? How do I skip such then? Or is it something about loading a m4a file even with ffmpeg and the desired output when tested on a single m4a file?
My code runs fine in normal mode but when i try to run it in debug mode it throws exception, I am trying to create a TF-IDF matrix of genre column in spotify_df. Why is this happening.
P.S - genre column of spotify_df contains 1-D list of strings and none of them is empty.
Code:
tracks_df = pd.read_csv('tracks_with_genres_v3.csv')
def create_tf_idf(spotify_df):
tfidf = TfidfVectorizer()
tfidf_matrix = tfidf.fit_transform(spotify_df['genres'].apply(lambda x: " ".join(x)))
genre_df = pd.DataFrame(tfidf_matrix.toarray())
genre_df.columns = ['genre' + "|" + i for i in tfidf.get_feature_names_out()]
genre_df.reset_index(drop=True, inplace=True)
return genre_df
def create_feature_set(spotify_df):
genre_tf_idf = create_tf_idf(spotify_df)
complete_feature_set = create_feature_set(tracks_df)
Exception:
Traceback (most recent call last):
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-packages\numpy\core\getlimits.py", line 516, in __init__
self.dtype = numeric.dtype(int_type)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2022.1.1\plugins\python\helpers\pydev\pydevd.py", line 1491, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2022.1.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/PyCharm/Music_Recommendation_v2/main.py", line 220, in <module>
begin("Heartless", "Weeknd")
File "D:/PyCharm/Music_Recommendation_v2/main.py", line 179, in begin
complete_feature_set = create_feature_set(tracks_df)
File "D:/PyCharm/Music_Recommendation_v2/main.py", line 115, in create_feature_set
genre_tf_idf = create_tf_idf(spotify_df)
File "D:/PyCharm/Music_Recommendation_v2/main.py", line 95, in create_tf_idf
tfidf_matrix = tfidf.fit_transform(spotify_df['genres'].apply(lambda x: " ".join(x)))
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-
packages\sklearn\feature_extraction\text.py", line 2068, in fit_transform
X = super().fit_transform(raw_documents)
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-
packages\sklearn\feature_extraction\text.py", line 1328, in fit_transform
vocabulary, X = self._count_vocab(raw_documents, self.fixed_vocabulary_)
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-
packages\sklearn\feature_extraction\text.py", line 1222, in _count_vocab
if indptr[-1] > np.iinfo(np.int32).max: # = 2**31 - 1
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-packages\numpy\core\getlimits.py",
line 518, in __init__
self.dtype = numeric.dtype(type(int_type))
TypeError: 'NoneType' object is not callable
The following code
If I run the following code in pdb (i.e. with python -m pdb)
if __name__=='__main__':
import pandas as pd
df=pd.DataFrame([[0,1,2],[63,146, 135]])
df.plot.area()
it fails with a TypeError inside a numpy routine that's called by matplotlib:
> python -m pdb test_dtype.py
> /home/jhaiduce/financial/forecasting/test_dtype.py(1)<module>()
-> if __name__=='__main__':
(Pdb) r
QSocketNotifier: Can only be used with threads started with QThread
--Return--
> /home/jhaiduce/financial/forecasting/test_dtype.py(6)<module>()->None
-> df.plot.area()
(Pdb) c
Traceback (most recent call last):
File "/usr/lib64/python3.10/site-packages/numpy/core/getlimits.py", line 384, in __new__
dtype = numeric.dtype(dtype)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.10/pdb.py", line 1726, in main
pdb._runscript(mainpyfile)
File "/usr/lib64/python3.10/pdb.py", line 1586, in _runscript
self.run(statement)
File "/usr/lib64/python3.10/bdb.py", line 597, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "/home/jhaiduce/financial/forecasting/test_dtype.py", line 6, in <module>
df.plot.area()
File "/usr/lib64/python3.10/site-packages/pandas/plotting/_core.py", line 1496, in area
return self(kind="area", x=x, y=y, **kwargs)
File "/usr/lib64/python3.10/site-packages/pandas/plotting/_core.py", line 972, in __call__
return plot_backend.plot(data, kind=kind, **kwargs)
File "/usr/lib64/python3.10/site-packages/pandas/plotting/_matplotlib/__init__.py", line 71, in plot
plot_obj.generate()
File "/usr/lib64/python3.10/site-packages/pandas/plotting/_matplotlib/core.py", line 294, in generate
self._post_plot_logic_common(ax, self.data)
File "/usr/lib64/python3.10/site-packages/pandas/plotting/_matplotlib/core.py", line 473, in _post_plot_logic_common
self._apply_axis_properties(ax.xaxis, rot=self.rot, fontsize=self.fontsize)
File "/usr/lib64/python3.10/site-packages/pandas/plotting/_matplotlib/core.py", line 561, in _apply_axis_properties
labels = axis.get_majorticklabels() + axis.get_minorticklabels()
File "/usr/lib64/python3.10/site-packages/matplotlib/axis.py", line 1201, in get_majorticklabels
ticks = self.get_major_ticks()
File "/usr/lib64/python3.10/site-packages/matplotlib/axis.py", line 1371, in get_major_ticks
numticks = len(self.get_majorticklocs())
File "/usr/lib64/python3.10/site-packages/matplotlib/axis.py", line 1277, in get_majorticklocs
return self.major.locator()
File "/usr/lib64/python3.10/site-packages/matplotlib/ticker.py", line 2113, in __call__
vmin, vmax = self.axis.get_view_interval()
File "/usr/lib64/python3.10/site-packages/matplotlib/axis.py", line 1987, in getter
return getattr(getattr(self.axes, lim_name), attr_name)
File "/usr/lib64/python3.10/site-packages/matplotlib/axes/_base.py", line 781, in viewLim
self._unstale_viewLim()
File "/usr/lib64/python3.10/site-packages/matplotlib/axes/_base.py", line 776, in _unstale_viewLim
self.autoscale_view(**{f"scale{name}": scale
File "/usr/lib64/python3.10/site-packages/matplotlib/axes/_base.py", line 2932, in autoscale_view
handle_single_axis(
File "/usr/lib64/python3.10/site-packages/matplotlib/axes/_base.py", line 2895, in handle_single_axis
x0, x1 = locator.nonsingular(x0, x1)
File "/usr/lib64/python3.10/site-packages/matplotlib/ticker.py", line 1654, in nonsingular
return mtransforms.nonsingular(v0, v1, expander=.05)
File "/usr/lib64/python3.10/site-packages/matplotlib/transforms.py", line 2880, in nonsingular
if maxabsvalue < (1e6 / tiny) * np.finfo(float).tiny:
File "/usr/lib64/python3.10/site-packages/numpy/core/getlimits.py", line 387, in __new__
dtype = numeric.dtype(type(dtype))
TypeError: 'NoneType' object is not callable
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib64/python3.10/site-packages/numpy/core/getlimits.py(387)__new__()
-> dtype = numeric.dtype(type(dtype))
(Pdb)
The error occurs only when run in the debugger; the program runs as normal when run outside the debugger.
Any idea what could be the cause of this?
When I execute the following statement:
spark.sql("SELECT CAST('0001-01-01' AS TIMESTAMP)").show()
I get:
CAST(0001-01-01 AS TIMESTAMP)
0001-01-01 00:00:00
but when I use spark.sql("SELECT CAST('0001-01-01' AS TIMESTAMP)").collect() I get the following error:
Fail to execute line 1: spark.sql("SELECT CAST('0001-01-01' AS TIMESTAMP)").collect()
Traceback (most recent call last):
File "/tmp/zeppelin_pyspark-6127737743421449115.py", line 380, in <module>
exec(code, _zcUserQueryNameSpace)
File "<stdin>", line 1, in <module>
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/dataframe.py", line 535, in collect
return list(_load_from_socket(sock_info, BatchedSerializer(PickleSerializer())))
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 147, in load_stream
yield self._read_with_length(stream)
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 172, in _read_with_length
return self.loads(obj)
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/serializers.py", line 580, in loads
return pickle.loads(obj, encoding=encoding)
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 1396, in <lambda>
return lambda *a: dataType.fromInternal(a)
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 633, in fromInternal
for f, v, c in zip(self.fields, obj, self._needConversion)]
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 633, in <listcomp>
for f, v, c in zip(self.fields, obj, self._needConversion)]
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 445, in fromInternal
return self.dataType.fromInternal(obj)
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 199, in fromInternal
return datetime.datetime.fromtimestamp(ts // 1000000).replace(microsecond=ts % 1000000)
ValueError: year 0 is out of range
In your timezone, 0001-01-01 would be treated as 0000-12-31 and the year value with 0 is invalid for the internal function ymd_to_ord() in the datetime package. See the reference
This is not happening in the scala version of spark.