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

README is out of date after most recent changes #35

Open
TomHogervorst opened this issue May 5, 2022 · 2 comments
Open

README is out of date after most recent changes #35

TomHogervorst opened this issue May 5, 2022 · 2 comments

Comments

@TomHogervorst
Copy link
Contributor

The README currently does not document the updated ways in which trace(Set) parameter maps can be used. Information about the default trace set parameter map and the automatic creation of the trace parameter definitions also needs to be included in the file.

@dsimonovic
Copy link

Following piece of code in README.md is a non-working piece of code, it is not self contained. No examples of how to create FileEngine type trs file.

import trsfile

with \
	trsfile.open(
		'trace-set',                  # Previously create trace set
		'r',                          # Read only mode
		engine='FileEngine'           # Using the FileEngine
	) as traces, \
	trsfile.open(                     # Note: TrsEngine is the default
		'trace-set.trs',              # Name of the new trace set
		'w',                          # Write mode
		headers=traces.get_headers()  # Copy the headers
	) as new_traces:
	new_traces.extend(traces)         # Extend the new trace set with the
	                                  # traces from the old trace set

@dsimonovic
Copy link

The most important example missing in the README.md is how to open trs file, do some simple signal processing, and save to a new file. I would say this piece of code should do, but I am not familiar enough with the library to be sure this is the proper way:

with trsfile.open('input.trs', 'r') as traceset_in:
    headers_clean = traceset_in.get_headers().copy()
    headers_clean.pop(Header.NUMBER_TRACES, None)
    headers_clean.pop(Header.TRACE_SET_PARAMETERS, None)
​
    with trsfile.open('output.trs', 'w', headers=headers_clean) as traceset_out:
        for trace in traceset_in:           
            processed_array = 0.5*trace.samples
            traceset_out.append(Trace(
                    SampleCoding.FLOAT,
                    processed_array,
                    trace.parameters)
            )

@aickerso aickerso added good first issue Good for newcomers and removed good first issue Good for newcomers labels Jul 1, 2024
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