Warning: Trying to access array offset on value of type null in /home/site/wwwroot/lib/plugins/move/action/rename.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/lib/plugins/move/action/rename.php:42) in /home/site/wwwroot/inc/actions.php on line 38
insert_peak [topas wiki]

User Tools

Site Tools


insert_peak

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
insert_peak [2012/01/12 02:58] – edit comment markers for auto-colouring rowlesmrinsert_peak [2025/06/05 08:01] (current) johnsoevans
Line 1: Line 1:
 +====== Insert_Peak ======
  
 +A single line macro to add a peak to a Rietveld fit.  There are lots of different ways of doing this.  The second macro uses fit_obj to plot the peak in the gui.
 +
 +Insert_Peak(twotheta, 20, lor, 0.1, fwhm, 0.15, int, 100)
 +
 +<code topas>
 +''Description: add single peak to e.g. rietveld fit
 +''Description: Insert_Peak(twotheta, 20, lor, 0.1, fwhm, 0.15, int, 100)
 +''Why: simple one line makes things easier
 +''Contributed by: John Evans
 +
 +macro Insert_Peak(p1,v1,p2,v2,p3,v3,p4,v4) {
 +#m_argu p1 ''2theta
 +#m_argu p2 ''lor
 +#m_argu p3 ''fwhm
 +#m_argu p4 ''int
 +If_Prm_Eqn_Rpt(p1, v1, min =0.9*v1; max =1.1*v1;)
 +If_Prm_Eqn_Rpt(p2, v2, min .000000000001 max 1)
 +If_Prm_Eqn_Rpt(p3, v3, min .000000000001 max 1)
 +If_Prm_Eqn_Rpt(p4, v4, min .000000000001 max 1e9)
 +xo_Is xo =CeV(p1,v1);  peak_type pv pv_lor =CeV(p2,v2);  pv_fwhm =CeV(p3,v3); I =CeV(p4,v4);
 +}
 +</code>
 +
 +Insert_Peak_Plot(peak_name,twotheta, 20, lor, 0.1, fwhm, 0.15, int, 100)
 +
 +<code topas>
 +'Insert a peak in  data using fit_obj to plot 
 + macro Insert_Peak_Plot(v0,p1,v1,p2,v2,p3,v3,p4,v4) {
 + #m_argu p1 '2theta
 + #m_argu p2 'lor
 + #m_argu p3 'fwhm
 + #m_argu p4 'int
 + If_Prm_Eqn_Rpt(p1, v1, min =0.9*v1; max =1.1*v1;)
 + If_Prm_Eqn_Rpt(p2, v2, min .000000000001 max 1)
 + If_Prm_Eqn_Rpt(p3, v3, min .000000000001 max 1)
 + If_Prm_Eqn_Rpt(p4, v4, min .000000000001 max 1e9)
 + fit_obj =  CeV(p4,v4) * ( CeV(p2,v2) * Lorentzian(CeV(p1,v1),CeV(p3,v3)) + (1 - CeV(p2,v2)) *  Gauss(CeV(p1,v1),CeV(p3,v3)) );
 + dummy_str space_group P1 phase_name v0 weight_percent 0
 + }
 +</code>