DB save question

32 views
Skip to first unread message

Orkan Ozcan

unread,
Feb 10, 2016, 4:27:13 PM2/10/16
to neurale...@googlegroups.com
Hello all,

I have a basic question that I couldn't solve. I load some analog signals from DB, modify them but I cannot save back to DB.

A sample script:
-------------------------------------------------
from OpenElectrophy import *

url = 'mysql://_____________'

open_db( url = url, myglobals= globals(), use_global_session = True)



b1= RecordingChannel.load (id= 114112)
b1.analogsignals0].signal[20:120] -= [40.]*100 # sample modification
b1.save()
-----------------------------------------------------


When I open the data on OpenElectrophy, I get the old version, not modified signal.


I will be happy to hear your suggestions.

Best
Orkan


Samuel Garcia

unread,
Feb 11, 2016, 3:19:37 AM2/11/16
to neurale...@googlegroups.com
Hi,
you are missing the quantities:

import quantities as pq

b1.analogsignals0].signal[20:120] -= [40.]*100*pq.mV



Sam
--
You received this message because you are subscribed to the Google Groups "Neural Ensemble" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neuralensembl...@googlegroups.com.
To post to this group, send email to neurale...@googlegroups.com.
Visit this group at https://groups.google.com/group/neuralensemble.
For more options, visit https://groups.google.com/d/optout.

Orkan Oz

unread,
Feb 12, 2016, 7:02:22 AM2/12/16
to Neural Ensemble
Hello all,

I made some improvements with Sam's suggestions but the problem still goes on. Just to clarifiy, I load a Block from DB, modify magnitude s of analog signals and save back. I can see the modification works on Python but not on DB after saving back. Sample script:

----------------------------------------------------

url = 'sqlite:///-----------------'

open_db( url = url, myglobals= globals(), use_global_session = True)



B_id = 186

B= Block.load(id=B_id)


signal1 = B.recordingchannelgroups[0].recordingchannels[count1].analogsignals[count2].signal.magnitude

signal1[i-5:i+25] = [start]*30 # sample modification

B.recordingchannelgroups[0].recordingchannels[count1].analogsignals[count2].signal.magnitude[:] = signal1


B.save()
----------------------------------------------------------------------------------------


Is there a write permission problem, or smt else I am missing?

Thanks in advance

Best
Orkan

Orkan Oz

unread,
Feb 18, 2016, 5:03:02 PM2/18/16
to Neural Ensemble
Dear all,

I manage to modify and save back the magnitude of the signal by loading and saving the Analog Signals one by one in the loop instead of saving the whole Block.

I hope this will help someone.

Best
Orkan
Reply all
Reply to author
Forward
0 new messages