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

Buffer not recognizing tag #24

Open
bscoventry opened this issue Jan 16, 2023 · 8 comments
Open

Buffer not recognizing tag #24

bscoventry opened this issue Jan 16, 2023 · 8 comments

Comments

@bscoventry
Copy link

bscoventry commented Jan 16, 2023

Hi all,

I've been using TDTPy successfully for the last few years, but have run into a strange problem. On running the test program included using the 'record_microphone.rcx' circuit, I get the following error at speaker_buffer = circuit.get_buffer('speaker', 'w'):
ValueError: size tag for RZ6:record_microphone.rcx:CxLdRn:speaker must be present in circuit
I then used the circuit.tags method and found that speaker is seen as a vector input. Looks good. Running the activeX code, I can also successfully write the sin to the speaker buffer.
Do you have any thoughts on what might be causing this? For reference, I've attached the exact code I'm running.

from numpy import arange, sin, pi
from tdt import DSPProject, DSPError
import pdb
if __name__ == "__main__":
  try:
          # Load the circuit
          project = DSPProject()
          circuit = project.load_circuit('record_microphone.rcx', 'RZ6')
          circuit.start()
  
          # Configure the data tags
          circuit.cset_tag('record_del_n', 25, 'ms', 'n')
          circuit.cset_tag('record_dur_n', 500, 'ms', 'n')
          pdb.set_trace()
          # Compute and upload the waveform
          t = arange(0, 1, circuit.fs**-1)
          waveform = sin(2*pi*1e3*t)
          speaker_buffer = circuit.get_buffer('speaker', 'w')
          speaker_buffer.write(waveform)
  
          # Acquire the microphone data
          microphone_buffer = circuit.get_buffer('mic', 'r')
          data = microphone_buffer.acquire(1, 'running', False)
      except DSPError:
          print("Error acquiring data: {}")

@bburan
Copy link
Collaborator

bburan commented Jan 17, 2023 via email

@bscoventry
Copy link
Author

Hi! I am using version 0.10.0

@bburan
Copy link
Collaborator

bburan commented Jan 17, 2023

Ok, thanks for the clarification.

It's been years since I looked at that particular circuit and I can't remember whether it actually worked or not. For example, the SerSource and SerStore are missing a speaker_n and mic_n tag which need to be linked to the size ports. This lets TDTPy inspect the circuit and figure out how many samples can be written/read from these. See the documentation for DSPBuffer (https://tdtpy.readthedocs.io/en/latest/dsp_buffer.html).

TDTPy has always supported continuous (streaming) reads from SerStore buffers (provided you have all the correct tags hooked up). However, I recently updated TDTPy to support continuous (streaming) writes to SerSource as well. I did my best to keep backwards compatibility in place. It's possible I broke something.

Can you give me a more specific example of why you are reporting this issue. Do you usually use that test code in the original post with every version of TDTPy, or did you whip it up because you were having trouble with the latest release? If so, can you spell out in more detail what exactly the issue is?

Alternatively, can you verify that the example script you write works on an earlier version of TDTPy?

@drammock
Copy link
Member

Hi! I am using version 0.10.0

there is no version 0.10.0? 😕 https://github.com/LABSN/tdtpy/releases

@bburan
Copy link
Collaborator

bburan commented Jan 17, 2023

I haven't been making releases to Github. They are available on PyPI though (e.g., https://pypi.org/project/TDTPy/0.10.0/) and also see the Git tags in this repo.

@bburan
Copy link
Collaborator

bburan commented Jan 18, 2023

@drammock Is there any value to creating releases on Github?

@drammock
Copy link
Member

@drammock Is there any value to creating releases on Github?

Eh, sort of. People do look there for releases sometimes (as I just did). The tags are more important probably.

it's possible to have a GitHub action automatically build wheels and upload them to pypi each time you make a release, which eliminate the double effort (but I think it's a bit tricky to set up... @larsoner has done it I think)

@bburan
Copy link
Collaborator

bburan commented Jan 20, 2023

@bscoventry I do believe you if you are stating there's an issue with TDTPy, but I need a little more information before I can advise and or fix the issue. For example, I have made TDTPy a bit more strict about the circuit design and what supporting tags must be present in the circuit to enable the streaming reads/writes. This could conceivably have broken code that did not have all the supporting tags present. I'm fleshing out the unit-test library (which was quite sparse before), so it would be good to know exactly what broke so we can incorporate that into our unit-tests.

I'm assuming that you found that a newer release of TDTPy does not work, so you tried the example circuit included in the documentation and found that did not work. I agree that we should have a working example circuit and script, but what I'm more interested in at this point is what specifically broke in your own code so we can fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants