Author Topic: how to plot some spectra?  (Read 6245 times)

Walter

  • Post Doc
  • ***
  • Posts: 11
how to plot some spectra?
« on: April 10, 2017, 01:33:48 AM »
Hello everyone,

I'm starting to know the real potential of CalcZAF. Initially I thought that it could calculate only the ZAF correction given the k-ratios  ::)
Now I've made some PENEPMA simulation. I've also wrote some scripts in MATLAB to build files for batch mode faster than by hand, if there wasn't already something like that and someone is interested I could upload them.

Anyway I'm realizing that there are a lot of function in the software but I think that they are a bit hidden and not user friendly to find  :P .

I know, from the guide and some images here on the forum, that exist a spectrum plotter (Plot Wavescan!). I'd like so visualize some specta that I've registered and simulated, but I can't find the application, could someone tell me where I could find it?

The guide says "Output | Plot Standards and Unknowns menu" but neither in CalcZAF and Standard there is such a voice in the Output menu...

Thank you

Ben Buse

  • Professor
  • ****
  • Posts: 499
Re: how to plot some spectra?
« Reply #1 on: April 10, 2017, 03:53:37 AM »
Hi Walter,

There are two programs, CalcZAF which is distributed freely. And the full software which drives a microprobe - PFE or Probe for EPMA. I think the functions your looking for are in PFE not CalcZAF

Ben
« Last Edit: April 10, 2017, 08:32:34 AM by John Donovan »

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: how to plot some spectra?
« Reply #2 on: April 10, 2017, 08:39:29 AM »
Hi Walter,
Ben is exactly correct, the plot wavescan functions are in the full Probe for EPMA package which is sold by Probe Software. Along with Probe Image and CalcImage, it provides a complete acquisition, automation, analysis and presentation output package for JEOL and Cameca EPMA instruments.  See our main web site for more information:

http://probesoftware.com/

However, there are some crude spectrum plotting GNU scripts provided with the Penepma distribution for plotting spectra, but I've never utilized them...    one possibility is that I could add an EMSA output button for Penepma generated spectra in the Standard application.   Note that one can already import and export EMSA spectrum files to/from the Standard database using the Standard | Modify menu.

If you have any specific questions about CalcZAF or Standard, I (and others) would be pleased to answer them in this board.
john
« Last Edit: April 10, 2017, 08:44:27 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Probeman

  • Emeritus
  • *****
  • Posts: 2858
  • Never sleeps...
    • John Donovan
Re: how to plot some spectra?
« Reply #3 on: April 10, 2017, 09:16:30 AM »
Now I've made some PENEPMA simulation. I've also wrote some scripts in MATLAB to build files for batch mode faster than by hand, if there wasn't already something like that and someone is interested I could upload them.

Hi Walter,
Note that you can create any number of input files for Penepma, for example, using the compositions in the standard database (to which you can add any of your own standard compositions) and run them using the Batch mode button...

When the Penepma simulations are run from the Batch window, the program automatically creates the appropriate folders and copies the final results there for you.  I use it all the time this way.  See here for more explanation:

http://probesoftware.com/smf/index.php?topic=151.0

john
The only stupid question is the one not asked!

Walter

  • Post Doc
  • ***
  • Posts: 11
Re: how to plot some spectra?
« Reply #4 on: April 11, 2017, 04:59:38 AM »
There are two programs, CalcZAF which is distributed freely. And the full software which drives a microprobe - PFE or Probe for EPMA. I think the functions your looking for are in PFE not CalcZAF

Ok this explains many things to me ;D

However, there are some crude spectrum plotting GNU scripts provided with the Penepma distribution for plotting spectra, but I've never utilized them...    one possibility is that I could add an EMSA output button for Penepma generated spectra in the Standard application.   Note that one can already import and export EMSA spectrum files to/from the Standard database using the Standard | Modify menu.

I've tried to import some spectra but is not working, may be the version of my EMSA files are different from the requested, don't know. But that's not a problem. I think that is more important visualize the output PENEPMA files because to open them is needed import them in some other softwares like excell, origin or MATLAB. When PENEPMA ends the simulation the spectrum is visualized but it's impossible to open and to overlap old simulations, that's could be helpfull


Hi Walter,
Note that you can create any number of input files for Penepma, for example, using the compositions in the standard database (to which you can add any of your own standard compositions) and run them using the Batch mode button...
When the Penepma simulations are run from the Batch window, the program automatically creates the appropriate folders and copies the final results there for you.

Yes, I've used the batch simulation and it's great but creating all the file needed for the simulation needs a lot of time. For example I've simulated 11 different layer of 3 different metals on copper at 2 different energy + all pure elements for a total of 74 simulations. Instead of create all single .in file I've wrote two MATLAB scripts that, given layers, elements and energies, provides to generate all .geo and .in files.

Also the extrapolation of k-ratios from output file is a bit tricky and it's possible done it on one file at time, maybe I'll write something also for that

Ben Buse

  • Professor
  • ****
  • Posts: 499
Re: how to plot some spectra?
« Reply #5 on: April 11, 2017, 08:07:36 AM »
The default for plotting spectra from penepma - is the spectra.gnu script as John says. This runs in gnuplot (wgnuplot) - you can download it and its a good little program - although not very user-friendly as it creates graphs based on scripts.

Ben

Ben Buse

  • Professor
  • ****
  • Posts: 499
Re: how to plot some spectra?
« Reply #6 on: April 11, 2017, 08:20:27 AM »
I think that is more important visualize the output PENEPMA files because to open them is needed import them in some other softwares like excell, origin or MATLAB.

You can do this already. All the penepma .dat files are text files and can be opened in text editor or other programs.

The spectra is given in pe-spect-1.dat (number may change). Picture shows spectra file created in standard "Create PENEPMA MAterial and Input Files (using Penepma12) for Cu metal.



Similarly the gnu script files you can open in text editor.

Ben
« Last Edit: April 14, 2020, 12:12:17 PM by John Donovan »

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: how to plot some spectra?
« Reply #7 on: April 11, 2017, 08:33:33 AM »
I've tried to import some spectra but is not working, may be the version of my EMSA files are different from the requested, don't know. But that's not a problem. I think that is more important visualize the output PENEPMA files because to open them is needed import them in some other softwares like excell, origin or MATLAB. When PENEPMA ends the simulation the spectrum is visualized but it's impossible to open and to overlap old simulations, that's could be helpfull

Hi Walter,
Please send me your EMSA file so I can test it with my code.  I'm sure I can fix this.

Yes, I've used the batch simulation and it's great but creating all the file needed for the simulation needs a lot of time. For example I've simulated 11 different layer of 3 different metals on copper at 2 different energy + all pure elements for a total of 74 simulations. Instead of create all single .in file I've wrote two MATLAB scripts that, given layers, elements and energies, provides to generate all .geo and .in files.

Please feel free to share your Matlab scripts with us here.  They sound very useful.
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

jon_wade

  • Professor
  • ****
  • Posts: 82
Re: how to plot some spectra?
« Reply #8 on: May 05, 2017, 02:09:55 PM »
Hi Walter

Not that I want to swerve you away from PFE, but you may find running large numbers of PENEPMA simulations easier to batch up and extract by running a standalone version.  If you are interested, I have a few bash scripts for extracting the data from penepma2015 runs and a few python scripts for converting the raw data to k-ratios,  outputting to a .csv for DTSA2 and plotting wt%.  They are not exactly suitable for everything (you may say 'not suitable for anything!') but I'm happy to share and/or help (just don't laugh at my ropey programming!)



John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: how to plot some spectra?
« Reply #9 on: May 05, 2017, 09:38:50 PM »
Not that I want to swerve you away from PFE, but you may find running large numbers of PENEPMA simulations easier to batch up and extract by running a standalone version.  If you are interested, I have a few bash scripts for extracting the data from penepma2015 runs and a few python scripts for converting the raw data to k-ratios,  outputting to a .csv for DTSA2 and plotting wt%.  They are not exactly suitable for everything (you may say 'not suitable for anything!') but I'm happy to share and/or help (just don't laugh at my ropey programming!)

Hi Jon,
Actually these scripts sound really useful.  I would use them myself as my Standard app only "batches" the calculation and saving of Penepma simulations. In fact it merely displays graphics for the current simulation that is running.

So please feel free to post your plotting scripts here and I won't laugh at your programming if you promise not to laugh at my programming!   :D
john
« Last Edit: May 07, 2017, 12:07:48 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

jon_wade

  • Professor
  • ****
  • Posts: 82
Re: how to plot some spectra?
« Reply #10 on: May 15, 2017, 03:38:21 PM »
[John, apologies this may need editing to make it fit the forum - I couldn't figure how to get the pics inline]

I’ll caveat the following by saying 'I dunno if this is any way useful!’.   

This is a bit messy as I did this for myself (an I do not consider myself a programmer - not since the days of my 6502 powered BBC micro!), but if anyone finds any of this useful, I’ll tidy it up, especially the plotting stuff (I can never be bothered with dialogues and the like, as you can see!).  They are not meant as a ‘turn key’ solution, more as an idea for the uninitiated.

The big advantage to me is I can run lots of scripts simultaneously on my old Mac monster - one instance per virtual core with no performance hit -  which makes SF calcs of complex geometries almost quick (and, dare I say, fun! OK, ok, fun is a moving target...).  This (the mac) , and the other data that PENEPMA can spit out, is the reason I run penepma as a standalone (and for straight penelope sims - its a hugely powerful code).

Heres a penepma2014 bash extract script i wrote - it pulls out the characteristic lines, for, in this case Si, and adds them before writing to a csv file (sample output) included .  A minor bit of editing and the standard can be extracted and saved as well:


on osx call it from the terminal in the parent directory with ‘sh extract2014_Si.sh'
« Last Edit: May 15, 2017, 03:57:46 PM by jon_wade »

jon_wade

  • Professor
  • ****
  • Posts: 82
Re: how to plot some spectra?
« Reply #11 on: May 15, 2017, 03:40:54 PM »
 To use this efficiently, I set up the file structure of all my runs with the distance or position of each file as the title, and the extract script in the parent file e.g.  :-

jon_wade

  • Professor
  • ****
  • Posts: 82
Re: how to plot some spectra?
« Reply #12 on: May 15, 2017, 03:56:03 PM »
This saves a a lot of time not having to fiddle with excel which tends to be where my mistakes happen.

Heres a small script that plot up the k-ratios and writes a the data out to a csv file.  You can do this for each element, cut and paste to a .csv file for DTSA2 and wt% is yours!  I should make the output calczaf friendly really…..

and output:-

As I say, this is not in the least bit clean or neat, but it does help a lot if you you have a lot of SF runs to do and I hope shows the power of standalone PENEPMA.  I have a few more scripts for plotting wt% if required and I will set up a web page over the summer detailing installation on osX if theres any interest and throw up a few more scripts / notes on .geo files.  PENEPMA is a very good use for old xeon based power Macs you may have hiding around your dept.  I've also attached a plot of Fe X-rays emanating from around a SiO2 blob embedded in an Fe wafer, which demonstrates the spatial data PENEPMA can produce. 
[actually, looking at it, I think the scale bar is wrong - but, hey, I reckon its a nice pic!]
« Last Edit: June 08, 2017, 04:34:36 PM by John Donovan »

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: how to plot some spectra?
« Reply #13 on: May 15, 2017, 04:09:21 PM »
[John, apologies this may need editing to make it fit the forum - I couldn't figure how to get the pics inline]

Hi Jon,
I think this will be useful.  Thanks for sharing your work.

To post inline images see this post:

http://probesoftware.com/smf/index.php?topic=2.msg4040#msg4040

john
« Last Edit: May 15, 2017, 04:19:27 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: how to plot some spectra?
« Reply #14 on: May 18, 2017, 08:16:09 AM »
This isn't super fancy, but I've added a "Plot Spectra" button to the Penepma GUI window as seen here:



It loads a Penepma input file and the associated spectrum data.  It's useful for viewing previously generated spectra, but only one at a time.
john
« Last Edit: April 14, 2020, 11:53:54 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"