About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
  • License: Freeware
  • Last update: 6 years ago
  • Total downloads: 143
  • Price: Free |
  • Operating system: Linux
  • Publisher: Eduardo Moguillansky
See full specifications

linux default iconpysdif Publisher's description

pysdif is a Python library that allows to read and write any kind of SDIF file, to define new kinds of frames and matrices and to read and write metadata.

pysdif is a Python library that allows to read and write any kind of SDIF file, to define new kinds of frames and matrices and to read and write metadata.

The matrices read from a sdif file are exposed as numpy arrays.

It exposes both a low level and a high level interface.

The low level interface for reading and writing sdif files mirrors the sdif library quite transparently so that the example files and utilities using it can be directly translated with it. In particular it does not create any intermediate objects, even the data of the matrices is a numpy array mapped to the c array read from disk, so no allocation takes place. Whereas this makes for very fast code, one has to take care to copy the data if it will be used longer, since by the time a new matrix is read this data is no longer valid.

to read for ex. 1TRC format:

import pysdif

sdif_file = pysdif.SdifFile('filename.sdif')
sig1TRC = pysdif.str2signature("1TRC")
while not sdif_file.eof:
if sdif_file.frame_numerical_signature) == sig1TRC:
print sdif_file.time
for n in range(sdif_file.matrices_in_frame):
if sdif_file.matrix_numerical_signature == sig1TRC:
data = sdif_file.get_matrix_data()
# data is now a numpy array but you must copy the data if
# you intend to keep it after you have read the matrix.
# One you read a new matrix, this data will be no longer valid
print data

a more natural way:

from pysdif import SdifFile
sdif_file = SdifFile('filename.sdif')
for frame in sdif_file:
if frame.signature == "1TRC":
print frame.time
for matrix in frame:
if matrix.signature == "1TRC":
print matrix.get_data()

the frames and the matrices resulting from the iteration are only guaranteed to be valid as long as no new frames and matrices are read

to write a SdifFile:

f = SdifFile('new_sdif.sdif', 'w')
# these are optional
# add some metadata
'name' : 'my name',
'date' : time.asctime(time.localtime())
# define new frame and matrix types
f.add_frame_type('1NEW', '1ABC NewMatrix, 1FQ0 New1FQ0')
f.add_matrix_type('1ABC', 'Column1, Column2')
# now you can begin adding frames
frame = f.new_frame('1NEW', time_now)
frame.add_matrix('1ABC', array([
[0, 1.2],
[3.5, 8.13],

# say we just want to take the data from an existing
# sdiffile, modify it and write it back
in_sdif = SdifFile("existing-file.sdif")
out_sdif = SdifFile("outfile.sdif", "w")
for in_frame in in_sdif:
if in_frame.signature == "1NEW":
new_frame = out_sdif.new_frame("1NEW", in_frame.time)
in_data = in_frame.get_matrix_data() # we know there is only one matrix
# multiply the second column by 0.5
in_data[:,1] *= 0.5
new_frame.add_matrix('1ABC', in_data)


System Requirements:

В· Python
Program Release Status:
Program Install Support: Install and Uninstall

pysdif Tags:

Click on a tag to find related softwares

Is pysdif your software?

Manage your software

Most Popular

linux default icon GDB 7.4
GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it... Read more
linux default icon Coral 0.9.1
Coral is a tool and a development platform to create and transform models and modeling languages.
linux default icon Forum Paid Plus Script 6.1
Forum Paid Pay Per Post Exchange is targeted at forum owners who wish to...
linux default icon sdo 0.6.5
Converts oracle SDO_GEOMETRY objects to WKT and GeoJSON.
linux default icon Get Paid Plus Script 6.1
Get Paid Plus Script

Related Category

» Other (877)
» Tools & Editors (359)
» Web Development (146)