python
132 posts — page 8
-
Export google analytics data via API with Python
Fun weekend hacking project: export google analytics data using the google APIs. Clone the latest version of the API client from: https://code.google.com/p/google-api-python-client there is an example for accessing analytics APIs in the samples/analytics folder, but you need to fill in clientsecrets.json.
-
Processing sources in Planck maps with Hadoop and Python
Purpose The purpose of this post is to investigate how to process in parallel sources extracted from full sky maps, in this case the maps release by Planck, using Hadoop instead of more traditional MPI-based HPC custom software.
-
How to use the IPython notebook on a small computing cluster
The IPython notebook is a powerful and easy to use interface for using Python and particularly useful when running remotely, because it allows the interface to run locally in your browser, while the computing kernel runs remotely on the cluster.
-
IPython parallell setup on Carver at NERSC
IPython parallel is one of the easiest ways to spawn several Python sessions on a Supercomputing cluster and process jobs in parallel. On Carver, the basic setup is running a controller on the login node, and submit engines to the computing nodes via PBS.
-
Simple Mixin usage in python
One situation where Mixins are useful in Python is when you need to modify a method of similar classes that you are importing from a package.
-
Interactive 3D plot of a sky map
update May 2024: See the new version of this tutorial Mayavi is a Python package from Enthought for 3D visualization, here a simple example of creating a 3D interactive map starting from a HEALPix pixelization sky map:
-
Butterworth filter with Python
Using IPython notebook of course: http://nbviewer.ipython.org/3843014/
-
IPython.parallel for Planck data analysis at NERSC
Planck is a Space mission for high precision measurements of the Cosmic Microwave Background (CMB), data are received as timestreams of output voltages from the 2 instruments on-board, the Low and High Frequency Instruments [LFI / HFI].
-
doctests and unittests happiness 2
nosetests -v --with-doctest Doctest: healpy.pixelfunc.ang2pix ... ok Doctest: healpy.pixelfunc.getallneighbours ... ok Doctest: healpy.pixelfunc.getinterpval ... ok Doctest: healpy.pixelfunc.getmapsize ... ok Doctest: healpy.pixelfunc.getminvalidnside ... ok Doctest: healpy.pixelfunc.getneighbours ...
-
some python resources
python tutorial: https://docs.python.org/3/tutorial/ numpy tutorial [arrays]: https://numpy.org/doc/stable/user/quickstart.html plotting tutorial: https://matplotlib.org/stable/tutorials/pyplot.html free online books: https://diveintopython3.net/ https://python.swaroopch.com/ install python (recommended): https://www.a
-
cfitsio wrapper in python
After several issues with pyfits, and tired of it being so overengineered, I've wrote my own fits I/O package in python, wrapping the C library cfitsio with ctypes. Pretty easy, first version completely developed in 1 day. https://github.com/zonca/pycfitsio
-
unit testing happiness
nosetests -v testallcols (pycfitsio.test.TestPyCfitsIoRead) ... ok testcolnames (pycfitsio.test.TestPyCfitsIoRead) ... ok testmove (pycfitsio.test.TestPyCfitsIoRead) ... ok testopenfile (pycfitsio.test.TestPyCfitsIoRead) ... ok testreadcol (pycfitsio.test.TestPyCfitsIoRead) ...
-
Pink noise (1/f noise) simulations in numpy
Pink noise (1/f noise) simulations in numpy
-
set python logging level
often using logging.basicConfig is useless because if the logging module is already configured upfront by one of the imported libraries this is ignored. The solution is to set the level directly in the root logger: logging.root.level = logging.DEBUG
-
pyfits memory leak in new_table
I found a memory leakage issue in pyfits.newtable, data were NOT deleted when the table was deleted, I prepared a test on github, using objgraph , which shows that data are still in memory: https://gist.github.com/884298 the issue was solved by Erik Bray of STSCI on March 28th, 2011 , see bug report: http://trac6.assem