Adding environmental variable in Python script
Perhaps looking for this (after importing os): os.environ[“VARIABLE”]=”/path/to/program” This is needed for example to set the jref path in order for multidrizzle package to run through a script.
Perhaps looking for this (after importing os): os.environ[“VARIABLE”]=”/path/to/program” This is needed for example to set the jref path in order for multidrizzle package to run through a script.
iPython is a great tool to work with Python interactively, imitating a MatLab environment especially when running with matplotlib and numpy [the pylab module, all can be automatically imported by starting pylab like: ipython –pylab]. So you can use it to load data and start playing around with them. Although …
Stumbled upon the various different licenses I though to write down some conclusions (if I really got into any…). A nice comparison table of free software licenses is given in the Wikipedia where it is easily to see which licenses allow: (i) the link with other licenses and (ii) releasing …
The routine loadtxt from numpy (numpy.loadtxt) can be used to load columns of data from various files. This works great as long as numbers exist and becomes buggy with strings. Suppose we have a file (named ‘test.test’) with these values: 3103725. 1616.93596535 13.656 0 2011-05-23T23:49:35 3139474. 1405.95436047 13.643 0 2011-05-23T23:51:16 …
In order to replace a character in a string with Python replace command can be used easily: str.replace(old, new[, count]) [return a copy of the string with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.] But …
Ubuntu 10.10 includes matplotlib-0.99 in their repositories, which is not the latest one, so you don’t get the latest cool features (like gridspec)! But as I need some of its features I decided to go on and install the latest version matplotlib-1.1.0, only 20 days after its launch ! First …
A very interesting post on the different ways readline can be used in Python: > .readlines() : reads the whole file at once and creates a list of lines > .readline() : reads one character at the time > .xreadlines() : reads one line at a time (for large files). …
What do you get if you combine IRAF and Python ? Of course something that starts with Py and ends with RAF, PyRAF, which combines IRAF’s tasks with the Python’s command (allowing to create more sophisticated scripts than the cl ones). But in order to implement these abilities in a …
Ok, maybe this post is not that important but it is one of the things that, although they seem so simple, you struggle to find the answer. After having downloaded matplotlib (a powerful library for 2D plots) my first plot through python was a success. But since I was plotting …