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

Time has more samples than signal. #146

Closed
MontyTHall opened this issue May 4, 2018 · 9 comments
Closed

Time has more samples than signal. #146

MontyTHall opened this issue May 4, 2018 · 9 comments

Comments

@MontyTHall
Copy link

MontyTHall commented May 4, 2018

Pyhton version

Please write here the output of printing sys.version
'2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]'

Platform information

Please write here the output of printing platform.platform()
'Windows-7-6.1.7601-SP1'

Numpy version

Please write here the output of printing numpy.__version__
'1.14.3'

mdfreader version

Please write here the output of printing mdfreader.__version__
'2.7.5'
`

Description

Please describe the issue here and eventually script used to use mdfreader

base = "cross_traffic3"
fileName = "C:\\Users\\xzcjml\\Documents\\dSPACE\\ControlDeskNG\\5.3\\Project_001\\Experiment_001\\Measurement Data\\" + base + ".mf4"
name_cav_id = "Model Root/slave/LCM_ProcessInputs/LCM_Read/LCM Slave/LCM_Subscribers/LCM Subscribers 40ms/CAV/cav_id"
name_cav_x = "Model Root/slave/LCM_ProcessInputs/LCM_Read/LCM Slave/LCM_Subscribers/LCM Subscribers 40ms/CAV/cav_x"
name_cav_y = "Model Root/slave/LCM_ProcessInputs/LCM_Read/LCM Slave/LCM_Subscribers/LCM Subscribers 40ms/CAV/cav_y"
name_rltvLaneTOS = "Model Root/slave/Control/TSTR/TSTR Component/Relative Lane/VaTSTR_e_RltvLaneTOS"

mdf = mdfreader.mdf(fileName)
cav_id = mdf.getChannelData(name_cav_id)
cav_x = mdf.getChannelData(name_cav_x)
cav_y = mdf.getChannelData(name_cav_y)
rltvLaneTOS = mdf.getChannelData(name_rltvLaneTOS)
print(len(cav_id))
print(len((mdf.getChannelData(masterName))))
exit(0)
masterName = list(mdf.masterChannelList.keys())[0]
for i, t in enumerate(mdf.getChannelData(masterName)):
    delta = t - lastTime
    if delta > win.DT:
        text.reset()
        win.reset()
        iz = cav_id[i]  <-- this fails because i > 1095
        xs = cav_x[i]
        ys = cav_y[i]

cav_id has 1095 rows
master has 1128 rows. Should they be the same?

The mf4 file was generated with dSPACE control desk. "for i, t in enumerate(mdf.getChannelData(masterName)):
" should iterate over the time stamps right? Why do I have 1128 time stamps, yet my signal "cav_id", "cav_x" and "cav_y" all have 1095 rows?

Thanks,

M

Also mentionning version of mdf file will be helpfull (using mdfvalidator or mdfreader if functionnal for reading)

print of issue related variables at the errors location and eventually mdfvalidator screenshots can help troubleshooting complicated issues

@cristi-neagu
Copy link
Contributor

It's kinda hard following the code if it's not formatted properly using the Insert code feature. Also, where do you get masterName from? Are you using, for example, mdf.getChannelMaster(cav_id)?

@MontyTHall
Copy link
Author

Looks like the following change works:

for i, t in enumerate(mdf.getChannelData(mdf.getChannelMaster(name_cav_id))):

@cristi-neagu
Copy link
Contributor

As far as i can tell, that's the correct way to get the time vector associated with a certain data channel.

@MontyTHall
Copy link
Author

Is there a forum of some type for this channel for basic q&a?

@cristi-neagu
Copy link
Contributor

Not as far as i know. Would be nice to have a forum. Would be even nicer if GitHub had a conversation page for each repo.

@MontyTHall
Copy link
Author

MontyTHall commented May 4, 2018

Sounds like I need to purchase the spec if I need to have questions answered. Because I thought there was only 1 timer. I had no idea that I needed to get a "master" for my channel.

@cristi-neagu
Copy link
Contributor

No need to purchase any spec. You can get it for free from ASAM. Also, if you use MDF Validator from Vector you can understand some things about the structure of the file. You can also ask questions here, i think.

@ratal
Copy link
Owner

ratal commented May 7, 2018

Hi,
Thanks Cristi for supporting, I was bit out of sight for some time.
There is a documentation going along with the package but I must admit this auto generated pdf is bit difficult to get in. Otherwise, if you look at the readme, major examples are there.
I would advise you to use the attribute .masterChannelList as much as possible. It will help you understand your file data structure, especially the rasters, just print it for instance in an interactive session like ipython. For each dataGroup you have a time channel, however, the channels could be absent or ommitted --> that is why you could have more time channels than actual data channels.
Otherwise, like mentionned Cristi, you could open your file with MDFValidator.
If you still have questions, please ask

@ratal
Copy link
Owner

ratal commented Aug 12, 2018

I guess questions were answered, long time

@ratal ratal closed this as completed Aug 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants