| 696 | |
| 697 | |
| 698 | def stream(IO='IO', |
| 699 | device=None, |
| 700 | integration=None, |
| 701 | samplingRate=None, |
| 702 | inChannels=None, |
| 703 | outChannels=None, |
| 704 | duration=None, |
| 705 | excitation=None, |
| 706 | callback=None, |
| 707 | *args, **kwargs): |
| 708 | """ |
| 709 | """ |
| 710 | # Code snippet to guarantee that generated object name is |
| 711 | # the declared at global scope |
| 712 | # for frame, line in traceback.walk_stack(None): |
| 713 | for framenline in traceback.walk_stack(None): |
| 714 | # varnames = frame.f_code.co_varnames |
| 715 | varnames = framenline[0].f_code.co_varnames |
| 716 | if varnames == (): |
| 717 | break |
| 718 | # creation_file, creation_line, creation_function, \ |
| 719 | # creation_text = \ |
| 720 | extracted_text = \ |
| 721 | traceback.extract_stack(framenline[0], 1)[0] |
| 722 | # traceback.extract_stack(frame, 1)[0] |
| 723 | # creation_name = creation_text.split("=")[0].strip() |
| 724 | creation_name = extracted_text[3].split("=")[0].strip() |
| 725 | |
| 726 | if device is None: |
| 727 | device = default.device |
| 728 | if integration is None: |
| 729 | integration = default.integration |
| 730 | if inChannels is None: |
| 731 | inChannels = default.inChannel[:] |
| 732 | if isinstance(excitation, SignalObj): |
| 733 | excit = True |
| 734 | excitData = excitation.timeSignal[:] |
| 735 | samplingRate = excitation.samplingRate |
| 736 | duration = excitation.timeLength |
| 737 | outChannels = excitation.channels[:] |
| 738 | else: |
| 739 | excit = False |
| 740 | if samplingRate is None: |
| 741 | samplingRate = default.samplingRate |
| 742 | |
| 743 | if IO in ['I', 'in', 'input']: |
| 744 | stream = Streaming(device=device, integration=integration, |
| 745 | inChannels=inChannels, duration=duration, |
| 746 | callback=callback, samplingRate=samplingRate, |
| 747 | *args, **kwargs) |
| 748 | |
| 749 | elif IO in ['O', 'out', 'output']: |
| 750 | if excit: |
| 751 | stream = Streaming(device=device, integration=integration, |
| 752 | outChannels=outChannels, duration=duration, |
| 753 | excitationData=excitData, |
| 754 | samplingRate=samplingRate, callback=callback, |
| 755 | *args, **kwargs) |