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

Printing the values of all tdms files in the same directory using the for loop in python #286

Open
adityabhandwalkar opened this issue Oct 17, 2022 Discussed in #285 · 0 comments

Comments

@adityabhandwalkar
Copy link

Discussed in #285

Originally posted by adityabhandwalkar October 17, 2022
I have a folder abc where I store my tdms files and I extract the data from those files using the the following function in python, now the problem is each time I run my main program I need to change the file number in the main so that I can run it, What I would like to do is that making changes into the load function and it will keep loop in same directory and print different values of files, lets say in abc I have file1.tdms, file2.tdms,... each time it should be printing values of different file in that folder abc

class loader():
    def load(self, path):

        
        tdms_file = TdmsFile.read(path)
        df = tdms_file.as_dataframe()
        file_read = TdmsFile.read(path)
        data = file_read.groups()[0].channels()[0].data
        
        plt.suptitle('Timeseries data', fontsize='30')
        plt.xlabel('Timestamp', fontsize ='20')
        plt.ylabel('feature values', fontsize='20')
        plt.plot(df.iloc[:,0])
        plt.show()
```</div>
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

1 participant