nmrglue.sparky

Functions for reading and writing Sparky (.ucsf) files.

This modules is imported as nmrglue.sparky and can be called as such.

User Information

User Functions

read(filename)

Read a Sparky file.

write(filename, dic, data[, overwrite])

Write a Sparky file.

read_savefile(savefile[, spectrum_file])

Reads in a Sparky .save file and the corresponding spectrum (.ucsf) file.

read_lowmem(filename)

Read a Sparky file using minimal memory.

write_lowmem(filename, dic, data[, overwrite])

Write a Sparky using minimum amounts of memory (tile by tile)

make_uc(dic, data[, dim])

Create a unit conversion object.

guess_udic(dic, data)

Guess parameter of universal dictionary from dic,data pair.

create_dic(udic[, datetimeobj, user])

Create a Sparky parameter dictionary from universal dictionary.

datetime2dic(datetimeobj, dic)

Add datetime object to dictionary

dic2datetime(dic)

Create a datetime object from a Sparky dictionary

Developer Information

Sparky file format information

Information on the Sparky file format can be found online at: http://www.cgl.ucsf.edu/home/sparky/manual/files.html and in the Sparky source file ucsffile.cc.

Developer Functions

These functions are typically not used directly by users. Developers who want fine control over Sparky files may be interested in these functions.

create_data(data)

Create a Sparky data array (recast into float32 array)

create_axisdic(adic, tlen, dlen)

Make an Sparky axis dictionary from a universal axis dictionary.

calc_tshape(shape[, kbyte_max])

Calculate a tile shape from data shape.

read_2D(filename)

Read a 2D sparky file.

write_2D(filename, dic, data[, overwrite])

Write a 2D Sparky file.

read_3D(filename)

Read a 3D Sparky file.

write_3D(filename, dic, data[, overwrite])

Write a 3D Sparky file.

read_lowmem_2D(filename)

Read a 2D Sparky file using minimal memory.

read_lowmem_3D(filename)

Read a 3D sparky file using minimal memory.

get_tilen(f, n_tile, tw_tuple)

Read a tile from a Sparky file object.

get_tile(f, num_points)

Read the next tile from a Sparky file object.

put_tile(f, tile)

Put a tile to a Sparky file object.

get_data(f)

Read all data from sparky file object.

put_data(f, data)

Put data to a Sparky file object.

find_tilen_2d(data, ntile, tile_size)

Return a tile from a 2D NMR data set.

tile_data2d(data, tile_size)

Tile 2D data into a 1D array.

untile_data2D(data, tile_size, data_size)

Rearrange 2D Tiled/Sparky formatted data into standard format.

find_tilen_3d(data, ntile, tile_size)

Return a single tile from a 3D NMR data set.

tile_data3d(data, tile_size)

Tile 3D data into a 1D numpy array

untile_data3D(data, tile_size, data_size)

Rearrange 3D tiled/Sparky formatted data into standard format.

get_fileheader(f)

Get fileheader from file and return a list.

put_fileheader(f, fl)

Write fileheader list to file (180-bytes).

fileheader2dic(header)

Convert a fileheader list into a Sparky parameter dictionary.

dic2fileheader(dic)

Convert a Sparky parameter dictionary into a fileheader list.

get_axisheader(f)

Get an axisheader from file and return a list.

put_axisheader(f, al)

Write an axisheader list to file (128-bytes written).

axisheader2dic(header)

Convert an axisheader list into Sparky parameter axis dictionary.

dic2axisheader(dic)

Convert a Sparky parameter axis diction into a axisherder list.

Developer Classes

sparky_2d(filename[, order])

Emulates a ndarray object without loading data into memory for low memory reading of 2D Sparky files.

sparky_3d(filename[, order])

Emulates a ndarray object without loading data into memory for low memory read of 3D Sparky files.