Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.eso.org/~qc/tqs/pyqc/python_demos.html
Дата изменения: Mon Dec 7 15:45:44 2009 Дата индексирования: Thu Apr 8 11:00:42 2010 Кодировка: Поисковые слова: ion drive |
Common Trending and QC tools:
|
tqs = Trending and Quality Control System |
![]() |
new: | see also: | ||||||||
A Radical Update of Python on the DFO machines. Python 2.6.2 + most up-to-date modules (December 2009) vimos_stdimg.tar scripts for QC on VIMOS imaging standard star fields (July 2009) qc_imadisp.py (May 2009, V1.2 with symbol overplotting July 2009) release of V1.1 for qclib and plot modules (March 2009) HAWK-I example scripts (March 2009) repository of example and tutorial scripts (December 2009) qc_detlin.py (February 2009) |
- description of library QClib
|
The best way to learn a new programming language is by jumping into the code feet first. So, I have put together a number of stand-alone python code that either teaches some unique aspect of Python, provides a useful function, or both. You should be able to simply cut and paste the code to your computer and run it (click on the routine's name to see the code and click on the image to see its output).
There is one caveat. Because python is changing so rapidly, some of these routines may not run on every platform, in particular, on our operational machines. My experience has been that python updates and modules try very hard to be backwards-compatible, but many of the new features in these updates will not work with the extremely archaic versions running on our dfo machines. If you have any problems please drop by and see me. . . Mark Neeser.
python script (click to view) | brief description | output (click to zoom) |
General Python and Python Plotting |
||
DEMO_datafit.py |
a python routine that fits two data curves. Includes plotting and a legend. Call: ./DEMO_datafit.py |
![]() |
DEMO_datafit_gauss.py | a python routine that fits data to a Gaussian. Call: ./DEMO_datafit_gauss.py |
![]() |
DEMO_fit_2d_gaussian.py | a python routine that fits a Gaussian to a 2 dimensional image (with added noise). The image is then plotted along with the fitted contours and text results. Call: ./DEMO_fit_2d_gaussian.py |
![]() |
DEMO_mask.py |
a python routine that shows off a number of cool (and useful) python attributes: 1. how to create an image built from a (500x500) grid and then assign it to a Gaussian-weighted sinusoid. Call: ./DEMO_mask.py |
![]() |
DEMO_shade_areas.py |
a python routine showing how to mark and shade areas of a plot. Call: ./DEMO_shade_areas.py |
![]() |
DEMO_log_plots.py |
a python routine that shows how easy it it to create log plots (base 10 or otherwise), and how python takes care of the scaling and the axis numbers automatically. Call: ./DEMO_log_plots.py |
![]() |
DEMO_math_text.py |
python also does TeX. . . here's the proof. Call: ./DEMO_math_text.py |
![]() |
Python and Python Plotting with Applications to QC |
||
DEMO_input_ascii_file.py |
a python routine that uses "asciidata" to read in an ascii data table (in this example a SeXtractor table). Just for fun I use this input to make four plots: 2 x 2. These plots include error bars, median lines, variables in the plot titles, and lots of colours. Requires the ascii file wave.sex Call: ./DEMO_input_ascii_file.py wave.sex |
![]() |
DEMO_image3.py |
a python routine that shows how easy it is to plot images, change their interpolation, add contours, add an overplot, and add a colour bar. Call: ./DEMO_image3.py |
![]() |
DEMO_image6.py | a python routine that shows how easy it is to plot FITS images. You can use any one of your own 2-d fits files, or the one that I have provided C3RBsub.fits . If you use your own image it should be at least 1k x 1k pixels, or you can edit the zoom view that I use. Call: ./DEMO_image6.py C3RBsub.fits |
![]() |
DEMO_persistence.py | a python routine that warns of the potential for persistence. (This is relevant to IR detectors, but could easily be adapted to warn of saturated pixels in other detector types). If an overly bright source is observed in some IR detectors, some of this flux remain visible in subsequent images (hence the name "persistence"). This routine will check any input image if it has connected pixels that exceed a user-given flux limit. You can use any image, or try this one from sinfoni. Call: ./DEMO_persistence.py -f <input_image> -p <persistence_critical_level> eg.: ./DEMO_persistence.py -f SI_PSNS_090130C_K_250.fits -p 10000 |
![]() |
|
||
DEMO_give_cursor_position.py |
python also allows you to make your plots interactive! In this example, your cursor position is continuously read out to the terminal. You can, of course, modify this such that the cursor position enter this program when a given key is pressed. Call: ./DEMO_give_cursor_position.py |
![]() |
DEMO_slider.py |
more python interactive plots. In this example, you can change the plot colour, the curves amplitude and its frequency. Call: ./DEMO_slider.py |
![]() |
DEMO_dynamic_image.py | python also allows the creation of dynamic plots. This may be useful if you have 3d data and want the image to rapidly scroll through each plane of your data cube. Call: ./DEMO_dynamic_image.py |
![]() |
How to pass variables from one python routine to another. Consider two python scripts: script_b.py ==> defines a function script_a.py ==> imports the variable and function of script_b Call: ./script_a.py 'None! They just call QC.'
|
Output: How many USD people does it take to change a broken light bulb? (this is from script_b) None! They just call QC. (this is from script_a) |
Send
comments to <mneeser@eso.org>
Last update: December 7, 2009 |