# IPFX analysis tool box - TTL input extraction

**URL:** <https://community.brain-map.org/t/ipfx-analysis-tool-box-ttl-input-extraction/2113>\
**Category:** Technical\
**Tags:** electrophysiology\
**Created:** [January 30, 2023, 1:25pm UTC](https://community.brain-map.org/t/ipfx-analysis-tool-box-ttl-input-extraction/2113 "2023-01-30T13:25:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnnaGalakhova](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/annagalakhova/32/681_2.png) [@AnnaGalakhova](https://community.brain-map.org/u/AnnaGalakhova)\
**Post date:** [January 30, 2023, 1:25pm UTC](https://community.brain-map.org/t/ipfx-analysis-tool-box-ttl-input-extraction/2113/1 "2023-01-30T13:25:53Z")

</div>

Hello everyone. I am using MIES to record and store my data in NWB format, and I use TTL as my input to stimulate extracellularly, although now when I want to get the stimulus TTL wave I can not get it. So I can get t,v and i for my sweeps, but not the TTL. Since the dataset file of the type EphysDataSet cannot be opened in spyder, I can’t understand how to get the input trace. How is it possible to extract?

Thank you in advacnce,

Anna

---

<div class="post-metadata">

**Author:** ![timjarsky](https://avatars.discourse-cdn.com/v4/letter/t/eb8c5e/32.png) [@timjarsky](https://community.brain-map.org/u/timjarsky)\
**Post date:** [February 1, 2023, 6:18pm UTC](https://community.brain-map.org/t/ipfx-analysis-tool-box-ttl-input-extraction/2113/2 "2023-02-01T18:18:37Z")

</div>

Hi Anna, the NWB TTL data is stored in the stimulus\>\>presentation group, the same location as the DA data.

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/brainobservatory/original/1X/dce5b97bb115f304b64e5e053cb95df2dfed0ded.png)

The MIES [documentation](https://alleninstitute.github.io/MIES/IPNWB/index.html) shows the naming convention: " \* For AD/DA/TTL groups the naming scheme is data\_`XXXXX`\_[AD/DA/TTL] `suffix` where `XXXXX` is a running number and `suffix` the channel number. For some hardware types the `suffix` includes the TTL line as well. It is important to note that the number of digits in `XXXXX` is variable and subject to change, and that `XXXXX` is _not_ the sweep number."

[PYNWB](https://pynwb.readthedocs.io/en/stable/tutorials/general/file.html) is commonly used to access data from NWB. MIES may also be used to browse the TTL data, and Igor could be used to save it in a suitable format.

---

<div class="post-metadata">

**Author:** ![AnnaGalakhova](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/annagalakhova/32/681_2.png) [@AnnaGalakhova](https://community.brain-map.org/u/AnnaGalakhova)\
**Post date:** [February 3, 2023, 1:58pm UTC](https://community.brain-map.org/t/ipfx-analysis-tool-box-ttl-input-extraction/2113/3 "2023-02-03T13:58:53Z")

</div>

Thank you for your answer!

I see that you show me the MIES window, while I try to get it in python.  
If I open the sweep object in there, there is no “presentation group” under the stimulus.  
Can this be an nwb-version issue?  
Also, I could the data in matlab, but the rest of analysis is in Python so I would like to be able to get it there too.

Thanks!

---

<div class="post-metadata">

**Author:** ![AnnaGalakhova](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/annagalakhova/32/681_2.png) [@AnnaGalakhova](https://community.brain-map.org/u/AnnaGalakhova)\
**Post date:** [August 2, 2023, 1:38pm UTC](https://community.brain-map.org/t/ipfx-analysis-tool-box-ttl-input-extraction/2113/4 "2023-08-02T13:38:27Z")

</div>

I am still struggling with that, to be honest. You now who me the structure of the file, while I am trying to extract the ttl wave from the ephys\_daata\_set object. Since I can’t open the structure of this object, I have no idea how to get to stimulus description and representation.- it is not in the sweep object group either… @timjarsky , would you mind suggesting me something on that?

---

<div class="post-metadata">

**Author:** ![t-b](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/t-b/32/429_2.png) [@t-b](https://community.brain-map.org/u/t-b)\
**Post date:** [August 3, 2023, 2:56pm UTC](https://community.brain-map.org/t/ipfx-analysis-tool-box-ttl-input-extraction/2113/5 "2023-08-03T14:56:43Z")

</div>

I’m one of the MIES authors.  
You are using NWBv2 files right?

If yes, here is what I tried locally with a MIES acquired file exported to NWBv2.

- Start python on the command line (python)
- import pynwb
- io = pynwb.NWBHDF5IO(“Packages/tests/HardwareBasic/HardwareBasic-V2.nwb”, mode=‘r’, load\_namespaces=True)
- nwbfile = io.read()
- nwbfile.stimulus.keys()  
// gives here  
// dict\_keys([‘data\_00000\_DA0’, ‘data\_00000\_DA1’, ‘data\_00000\_TTL1\_2’, ‘data\_00000\_TTL1\_8’, ‘data\_00000\_DA2’])
- nwbfile.stimulus[‘data\_00000\_TTL1\_2’] # access a single TTL timeseries

I’ve used pynwb version 2.3.2 on Windows.
