Skip to main content

A python translation of the Grad2Surf software provided by Harker & O'Leary

Project description


Software that effectively integrates two vector fields to obtain a scalar field. Example usage can be seen at [cthulhu]( This repo merely reflects a python translation of the MATLAB code supplied by Harker & O'Leary: [paper]( and [code](

An excerpt from [cthulhu](

grid_x, grid_y = np.meshgrid(np.linspace(-self.radius, self.radius, resolution),
np.linspace(-self.radius, self.radius, resolution))
self.grid_dra = np.flipud(np.fliplr(griddata(np.vstack((ra, dec)).T, ra_shifts,
(grid_x, grid_y), method=interp_method, fill_value=0)))
self.grid_ddec = np.flipud(np.fliplr(griddata(np.vstack((ra, dec)).T, dec_shifts,
(grid_x, grid_y), method=interp_method, fill_value=0)))
self.tec = np.flipud(g2s_method(grid_x[0, :], grid_y[:, 0], self.grid_dra, self.grid_ddec))

where ```grid_dra``` and ```grid_ddec``` are generated from griddata from scipy.interpolate. Put simply, the gradient values (```ra_shifts``` and ```dec_shifts```) at the spatial positions (```ra``` and ```dec```) are gridded to form vector fields, which are then integrated by pyGrad2Surf.

A number of g2s methods are detailed by Harker & O'Leary, however, only the basic g2s method is available here. The other methods require some work to translate, thanks to syntactic and functional differences between python and MATLAB. These may or may not be completed in the future, but pull requests are welcome.

christopherjordan87 -at-

- python 2.7.x
- numpy
- scipy

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyGrad2Surf, version 0.1.0
Filename, size & hash File type Python version Upload date
pyGrad2Surf-0.1.0-py2.py3-none-any.whl (9.8 kB) View hashes Wheel py2.py3

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page