Changeset c3f0114 in sasview


Ignore:
Timestamp:
Aug 5, 2016 7:35:03 AM (8 years ago)
Author:
lewis
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
535e181
Parents:
6eaf89ea
Message:

Remove debug statements and tidy up

Location:
src/sas/sascalc/file_converter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/file_converter/bsl_loader.py

    r6eaf89ea rc3f0114  
    2121 
    2222        while True: 
    23             import pdb; pdb.set_trace() 
    2423            metadata = header_file.readline().strip() 
    2524            metadata = metadata.split() 
     
    4342            except: 
    4443                is_valid = False 
    45                 err_msg = "Invalid metadata in header file for {}".format(filename.replace('0.', '1.')) 
     44                err_msg = "Invalid metadata in header file for {}" 
     45                err_msg = err_msg.format(filename.replace('0.', '1.')) 
    4646            break 
    4747 
  • src/sas/sascalc/file_converter/c_ext/bsl_loader.c

    r6eaf89ea rc3f0114  
    2525    const int n_rasters; 
    2626    const int swap_bytes; 
     27 
    2728    if (self != NULL) { 
    2829        if (!PyArg_ParseTuple(args, "siiii", &filename, &frame, &n_pixels, &n_rasters, &swap_bytes)) 
     
    5758} 
    5859 
     60/*                    ----- Setters and Getters -----                        */ 
     61 
    5962static PyObject *get_filename(CLoader *self, PyObject *args) { 
    6063    return Py_BuildValue("s", self->params.filename); 
     
    121124    return Py_BuildValue("i", self->params.swap_bytes); 
    122125} 
     126 
     127/*                        ----- Instance Methods -----                       */ 
    123128 
    124129float reverse_float(const float in_float){ 
     
    141146    int size[2] = {self->params.n_rasters, self->params.n_pixels}; 
    142147    float cur_val; 
    143     PyObject *read_val; 
    144148    FILE *input_file; 
    145149    PyArrayObject *data; 
    146150 
    147     printf("load_data called\n"); 
    148  
    149151    if (!PyArg_ParseTuple(args, "O!", &PyArray_Type, &data)) { 
    150         printf("Failed parsing PyArray object"); 
    151152        return NULL; 
    152153    } 
     
    154155    input_file = fopen(self->params.filename, "rb"); 
    155156    if (!input_file) { 
    156         printf("Failed opening file\n"); 
    157         return NULL; 
    158     } 
    159  
    160     printf("Calculating frame_pos\n"); 
     157        return NULL; 
     158    } 
     159 
    161160    frame_pos = self->params.n_pixels * self->params.n_rasters * self->params.frame; 
    162     printf("frame_pos: %d\n", frame_pos); 
    163161    fseek(input_file, frame_pos*sizeof(float), SEEK_SET); 
    164     printf("fseek completed\n"); 
    165162 
    166163    for (raster = 0; raster < self->params.n_rasters; raster++) { 
     
    170167                cur_val = reverse_float(cur_val); 
    171168            PyArray_SETITEM(data, PyArray_GETPTR2(data, raster, pixel), PyFloat_FromDouble(cur_val)); 
    172             read_val = PyArray_GETITEM(data, PyArray_GETPTR2(data, raster, pixel)); 
    173169        } 
    174170    } 
    175     printf("Data read.\n"); 
    176171 
    177172    fclose(input_file); 
    178     printf("File closed\n"); 
    179173    Py_DECREF(data); 
    180     printf("Function completed\n"); 
     174 
    181175    return Py_BuildValue("O", data); 
    182176} 
     177 
     178/*                           ----- Class Registration -----                  */ 
    183179 
    184180static PyMethodDef CLoader_methods[] = { 
Note: See TracChangeset for help on using the changeset viewer.