Run method: starts recording during Tmax seconds Outputs a signalObj with the recording content
(self)
| 414 | |
| 415 | # Rec Methods |
| 416 | def run(self): |
| 417 | """ |
| 418 | Run method: starts recording during Tmax seconds |
| 419 | Outputs a signalObj with the recording content |
| 420 | """ |
| 421 | # Code snippet to guarantee that generated object name is |
| 422 | # the declared at global scope |
| 423 | # for frame, line in traceback.walk_stack(None): |
| 424 | for framenline in traceback.walk_stack(None): |
| 425 | # varnames = frame.f_code.co_varnames |
| 426 | varnames = framenline[0].f_code.co_varnames |
| 427 | if varnames == (): |
| 428 | break |
| 429 | # creation_file, creation_line, creation_function, \ |
| 430 | # creation_text = \ |
| 431 | extracted_text = \ |
| 432 | traceback.extract_stack(framenline[0], 1)[0] |
| 433 | # traceback.extract_stack(frame, 1)[0] |
| 434 | # creation_name = creation_text.split("=")[0].strip() |
| 435 | creation_name = extracted_text[3].split("=")[0].strip() |
| 436 | |
| 437 | # Record |
| 438 | recording = sd.rec(frames=self.numSamples, |
| 439 | samplerate=self.samplingRate, |
| 440 | mapping=self.inChannels.mapping, |
| 441 | blocking=self.blocking, |
| 442 | device=self.device, |
| 443 | latency='low', |
| 444 | dtype='float32') |
| 445 | recording = np.squeeze(recording) |
| 446 | recording = SignalObj(signalArray=recording*self.inChannels.CFlist(), |
| 447 | domain='time', |
| 448 | samplingRate=self.samplingRate) |
| 449 | recording.channels = self.inChannels |
| 450 | recording.timeStamp = time.ctime(time.time()) |
| 451 | recording.freqMin, recording.freqMax\ |
| 452 | = self.freqMin, self.freqMax |
| 453 | recording.comment = 'SignalObj from a Rec measurement' |
| 454 | recording.creation_name = creation_name |
| 455 | _print_max_level(recording, kind='input') |
| 456 | return recording |
| 457 | |
| 458 | |
| 459 | # PlayRecMeasure class |
no test coverage detected