Documentation

From PyPulsar
Jump to: navigation, search

Print this page

Contents

Installation

Win32

  • For windows (WIN32):
    • Download the setup-pypulsar-0.1.186.exe corresponding to the latest version 0.1.186 of pyPulsar
    • Execute setup-pypulsar-0.1.186.exe and choose the installation directory %INSTDIR when asked.
      • by default it is: C:\Program Files\pyPulsar-0.1.186.
      • you can change it to , e.g., D:\pyPulsar.
    • Finish the installation.

Linux

  • For Unix/Linux platforms, you can use Wine to run this program.

(A fully native Linux application will be provided soon!).


You are ready to start simulating and I hope to enjoy the program!

Getting started

  • Execute the pyPulsar.exe program (using the Start menu in windows) or by clicking on the pyPulsar.exe icon in the installation directory %INSTDIR.
    • Select open in the menu file, and choose in the %INSTDIR\Workspace directory, the Simple.pul demo file.


Screenshot3.jpg

  • Select compute in the menu simulation - Warning: If some modifications are done to the *.pul script, changes must be saved before running the simulation..
  • The simulation process should start.

A very simple example

 #------------------------------------------------------------------------------
 # Purpose:
 #   A very simple quadrupolar spectra simulation
 #------------------------------------------------------------------------------
 
 # start a new simulation
 #-----------------------
 sim=Simulation(verbose=true)
 
 # Set observation channel
 #------------------------
 sim.set_channel("23Na")
 
 # Nucleus definition 
 #-------------------- 
 Na=Nucleus("23Na")   
 Na.set_quadrupole(cq="1.5 mhz", eta=0.3)    
 Na.set_chemicalshift(iso="1 ppm") 
 Na.set_lb("200 Hz")          
 sim.add_nucleus(Na)        
 
 # simulation setting
 #-------------------            
 sim.set_spinningspeed("1.5 kHz")              
 sim.set_sw("20 kHz")
 
 # Pulse sequence
 #---------------
 sim.set_idealpulse()
 
 # Run simulation
 #----------------
 sim.select_observed()
 sim.set_nsb(AUTO) 
 sim.execute_pulsar()                  
 sim.store_spectrum()
 
 #Write spectra
 #-------------
 sim.write_spectra()

This example script can be found in the Workspace folder of the pyPulsar distribution: Simple.demo.pul

Modifications of demo file are not advised because the changes can be overwritten when a new release installation occurs. It is thus recommended to 'Save As' this file with another file name: e.g., Simple.pul.

Executing this script should produce an ouptput similar to this:

Simple.png

Such a script is written in the Python programming language (with some restrictions). Therefore, syntax rules for Python programming language apply to pyPulsar script. See Basic Python Syntax Rules.

File missing?: http://www-lcs.ensicaen.fr/pyPulsar/skins/common/images/icons/icon-pul.png Download Simple.pul http://www-lcs.ensicaen.fr/pyPulsar/skins/common/images/icons/info.png

Start the script

 sim=Simulation(verbose=true)

This statement is required to be the first statement in the script: it creates a new instance of the class Simulation. By default, it is set for a spectrometer with a proton resonance frequency of 400MHz. This can be easily changed:

 sim=Simulation(verbose=true,protonfrequency="800 MHz")  
 sim.set_channel("23Na")

The set_channel statement tells the simulation program that the observed channel will be Sodium-23 (23Na).

Until now, pyPulsar can handle ONLY two simultaneous channels at the maximum.

e.g.,we can write:

 sim.set_channel("23Na", "1H")

that tells the program that two channels, S (for 23Na) and I (for 1H), are opened.

The generic name of the two channels is S and I. See Dipolar couplings for more information about this.

Nucleus definition

 Na=Nucleus("23Na")   
 Na.set_quadrupole(cq="1.5 mhz", eta=0.3)    
 Na.set_chemicalshift(iso="1 ppm") 
 Na.set_lb("200 Hz")  
 sim.add_nucleus(Na)

the add_nucleus statement adds the above defined nucleus to the simulation

Notes:

  • as it is the first one to be defined, its index is 0 (this is because lists and arrays in Python always start with the index 0).
  • If the set_channel statement is missing, the first nucleus added using add_nucleus, also defines the observed channel.

Other simulation settings

 sim.set_spinningspeed("1.5 kHz")              
 sim.set_sw("20 kHz")

The above lines define some spectrometer settings. For more information on the available parameters, see Class Simulation.

Pulse sequence

 sim.set_idealpulse()  

This is the most simple pulse sequence that can be written: A single "perfect" pulse.

A slightly more complex pulse sequence can be:

 sim.set_pulse(length=10,powerS=100*kHz)   

which set a single pulse with a duration of 10 µs and a rf power of 100 kHz

Run

 sim.select_observed()

This command tells the program which individual nucleus on the observed channels will be computed with the command execute_pulsar. In the present example, as there is only one defined nucleus, there is no parameter to this command (otherwise, it can be 0).

 sim.set_nsb(AUTO)

We can say here the number of spinning sideband to calculate (or it can be estimated automatically, using the keywords AUTO.

 sim.execute_pulsar() 

Now the program is running!... some displays occurs in the 'Log' windows, if verbose was chosen in the definition of the simulation instance.

 sim.store_spectrum()

Then the results is stored for the display

 sim.write_spectra()

and finally a file is written on hard-disk (with the extension *.spe).

A list of examples

To see additional examples: Examples

Personal tools
Espaces de noms

Variantes
Actions
pyPulsar
Help
Library
Toolbox