Opened 6 years ago

#1192 new defect

recode the BSL loader in python

Reported by: pkienzle Owned by:
Priority: major Milestone: SasView 4.3.0
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description

The bsl loader in sascalc.file_converter is currently written in C but it could be easily recoded into python. This will aid in long term maintenance.

The following method would do most of the work:

def load_data(self):
    little_endian = not self.swap_bytes
    with open(self.filename, 'rb') as fp:
        frame_pos = self.n_pixels * self.n_rasters * self.frame
        fp.seek(frame_pos*4)
        dtype = '<f4' if little_endian else '>f4'
        data = numpy.fromfile(fp, dtype, self.n_rasters*self.n_pixels)
    return data

The rest of the C code is just getters/setters for n_pixels, n_rasters and frame.

Change History (0)

Note: See TracTickets for help on using tickets.