Working with the Astro-WISE software involves working with a command line interface. The interface is in fact the standard interactive http://www.python.org/doc/Intros.htmlPython interpreter, customized to facilitate our needs. It is assumed that you have followed the steps in http://www.test.astro-wise.org/portal/howtos/man_howto_start/man_howto_start.shtmlGetting started. now start the interpreter:
> aweThis will print a message such as the following:
Python 2.7.6 (default, Jan 8 2014, 14:02:13) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. Welcome to the Astro-WISE Environment | You are running the AWBASE version Importing Astro-WISE packages. Please wait... Distributed Processing Unit: dpu.hpc.rug.astro-wise.org Dataserver: ds.astro.rug.astro-wise.org Current profile: - username : <your database username> - database : db.astro.rug.astro-wise.org - project : <your active project> - current privileges : 1 (MyDB) awe>At this point most (all?) of the classes/modules that you need are automatically imported. As this happens, the consistency of those parts of the code that are relevant to the database and that you may have in your personal version is checked. This takes several seconds. You can see all defined variables (including the classes and modules) in the current so-called namespace by typing:
awe> dir()In fact, to get insight in classes, arguments etc., always rely on the combination of:
awe> dir(<module, class, attribute or method>)and
awe> help(<module, class, attribute or method>)and
awe> <module,class,attribute>.__doc__>For example:
awe> PhotometricParameters.zeropnt.__doc__ 'The response of the instrumental setup [mag]'or if you have an instantation pp of the class PhotometricParameters already:
awe> pp.__class__.zeropnt.__doc__ 'The response of the instrumental setup [mag]'
The type(<object>) command returns the type of the object. For example
awe> a=1 awe> type(a) <type 'int'> awe> photcat=PhotSrcCatalog() awe> type(photcat) <class 'astro.main.PhotSrcCatalog.PhotSrcCatalog'>
The awe-prompt includes functionality from the ``readline'' library. This library is used in Linux shells and Emacs. Here is a non-exhaustive list of its functionality:
Along with Astro-WISE packages, pylab (matplotlib) is automatically imported. Matplotlib is a powerful Python plotting tool, with close ties to MatLab. Plots can be made for example as follows:
awe> x = range(10) awe> y = [3*i**2 + 10 for i in x] awe> pylab.scatter(x,y)or
awe> pylab.plot(x,y)again, use
awe> help(pylab.plot)to get help with the syntax.
For more information on matplotlib, see the manual at http://matplotlib.sourceforge.net/http://matplotlib.sourceforge.net/.
Operations on large arrays and matrices is the speciality of the numpy package. For example:
awe> a = numpy.arange(1000000, dtype='float').reshape((1000,1000)) awe> b = numpy.arange(1000000, dtype='float').reshape((1000,1000)) awe> b = b.transpose() awe> c = a/b
Along with the above application oriented packages, several standard Python modules are also imported. Two major functionalities of these modules are:
With the os module, system commands can be executed for example as follows:
awe> os.system('pwd') awe> os.system('ls')
With the glob module, lists of (existing) files can be easily created using the standard Linux shell wildcards:
awe> filenames = glob.glob('OMEGACAM.2014*.fits') awe> filenames = glob.glob('OMEGACAM.2014-0[3-9]*_?.fits')