Menus Submenus and computing software

Affiliation
American Association of Variable Star Observers (AAVSO)
Tue, 12/01/2015 - 18:24

Spectroscopy software such as ISIS, VSPEC, and Audela are menu driven where one enters
data that does not update a database but instead is passed on to some
kind of computing program that then sends the results to the computer
screen. VSPEC in particular allows one to modify a profile displayed on
the screen and this then is somehow converted to a new profile that
incorporates these changes. How this interface is done is a mystery to
me. Everything is menu driven. Even a binary star program, Poebis, works
this way and it seems it is common knowledge among amateurs as to how to
construct menus like this. Could someone clue me in how this is done? I
am not requesting details but just references to the types of software
or programming language that is used to create these user friendly
systems. I know ACCESS can be used to create data entry screens that
updates databases, but I am not sure it is being used to do the more
powerful things that ISIS, VSPEC, AUDELA, and PHOEBIS does.
Stan

Affiliation
American Association of Variable Star Observers (AAVSO)
GUI coding

I believe Audela is written in TCL/Tk, so you'd want to look for a book on that language and graphical toolkit.  There are MANY different languages/libraries you can use.  E.g. if you want to program in C, you could use the X Window System libraries, often with Motif as an intermediate level programming interface.  I'm sure there are multiple graphical libraries available for Python, but I haven't ventured there yet.  The Tk graphical library that is used with TCL, is also available for Python, I see.

Java is another language commonly used for such programs.

Generally such programs are structured a bit differently compared to a good old FORTRAN program.  The latter would typically read some input, perform some computations based on those numbers, and then print or write some output, and then quit.  In a FORTRAN program of the old days, if you wanted graphical output, your program would write a file that contained instructions for pen plotter which would make your graph, offline.  I'm really dating myself here!  100% non-interactive.

A program with a graphical user interface must set up the interface (e.g., make function calls to define all the dropdown menus, buttons, etc, have code to be executed when a specific menu  item is selected, or button is pushed, etc, and define what the graphical interface should look like), and then loop forever, waiting to respond to the calls that are generated when those events (mouseclicks on a "button" for example) happen.  The program stops when a handler calls an exit function (e.g. in respond to a menu item "quit").

Your "science" code would be embedded with all the interface code.  E.g. you would have boxes that accept numbers (e.g., masses of the the two stars in your binary system)... and somewhere you'd have a "compute" button handler, that when the "compute" button was clicked on, would do the scientific computations that all this is being written for, using the numbers from the parameter input boxes, and, e.g., plot a graph of the results.

I wouldn't have said that a lot amateur astronomers do this kind of programming, but a few do.  It is not hard to throw something together that will use a GUI to drive some process -- but I've been doing some degree of non-professional programming for 40 years... starting with using FORTRAN and PLOT10 graphics to generate off-line plot tapes for Calcomp plotters...  now found in museums, or more likely, landfills.

I hope this helps a tiny bit...  it is uber brief, and approximate and colloquial...   For other resources, search on things like "gui hellow world tutorial in python" or whatever your prefered language is.  I took courses in this years ago:  we used C and X, which is harder than using things like Python/Tk, so I can't recommend any particular books.  

Gary Billings

 

 

Affiliation
American Association of Variable Star Observers (AAVSO)
Menus Submenus and computing software

Thanks, Gary. It looks pretty involved. I am an oldie like you and did programming when I had a career job, but it was using SPSS in batch mode (IBM mainframe) through Panvalet. I have also done some SAS programming, but it was not anywhere near as extensive as what I did in SPSS. I now own my own pc copy of SPSS (impossible to do with SAS because SAS is oriented toward large agencies that can afford it) which now comes with Python. Based on what you said, it appears the best option is to explore Python (there is a user manual in SPSS) as well as rereading your response and doing some internet searches on the other things you mentioned.

Your name is familiar. Have I met you?

Stan

Affiliation
American Association of Variable Star Observers (AAVSO)
Python

Hi Stan,

I analyze my spectra using code that I wrote in Python. While I haven't created a GUI for my code, I've been pleasantly surprised at how easy it is in Python to reduce and analyze spectra (and CCD images in general). In particular, the open-source astropy package contains a number of very useful functions (e.g., opening a .fits image as an array). The learning curve is pretty manageable, too.

If Python interests you, I'd further recommend that you consider using an iPython notebook (http://ipython.org/notebook.html). It helps with organizing code.

Colin

Affiliation
American Association of Variable Star Observers (AAVSO)
Menus Submenus and computing software

Thanks, Colin. From your experience it appears that Python is something that could work. It will be interesting to see how it handles .fit files. Currently, to analyze an image in SPSS I create an ASCII file using CCDOPS and then read it into SPSS as a .txt file. That works good but it involves an extra step, using CCDOPS, and doing some copying to the correct working folder.

Stan

Affiliation
American Association of Variable Star Observers (AAVSO)
Python & opening .fits files

Hi Stan,

Loading a .fits image into memory in Python is much simpler than that. With the astropy package, it can be done in just three lines of code! Here's a demonstration. The first three lines of code open the file "test.fit" from the working folder and save the actual image data into an array that I name "CCD_image." The last three lines produce a pop-up window displaying that array as an image.

 

from astropy.io import fits
hdu= fits.open("test.fit")
CCD_image = hdu[0].data

from matplotlib import pyplot as plt
plt.imshow(CCD_image)
plt.show()

Once the .fits file is loaded as an array, it's easy to manipulate.

Best Regards,

Colin