Exemple #1
0
 def action_analyze(self):
     values = AnalyticCalc.compute_all(self.params)
     res = rt_jinja.render(
         '''
         Kx: $Kx
         Ky: $Ky
         Wavelength (m)      Phot. energy (eV)
         1st harmonic: $lam_rn   $e_phn
         3rd harmonic: $lam_rn_3   $e_phn_3
         5th harmonic: $lam_rn_5  $e_phn_5
         Critical energy: $E_c eV
         -----------------------------------
         Rad spot size: $RadSpotSize m
         Rad divergence: $RadSpotDivergence rad
         -----------------------------------
         Length of ID: $L_id m
         Radiated power: $P_W W
         Central Power Density:
         $P_Wdc W/mrad2
         Spectral flux:
         $SpectralFluxValue phot/(sec mrad 0.1% BW)
         Spectral Central Brightness:
         $RadBrightness phot/(sec mrad2 0.1% BW)
         -----------------------------------
         ''',
         values,
     )
     self._view.set_result_text('analysis', res)
Exemple #2
0
def test_render():
    """Verify render"""
    from radtrack.rt_jinja import render
    p = dict(a=999.0, b=999.0, CdeF=6789, d=.001, e=.000999, f=1000.0)
    assert '999.000 999.0 6789 0.001 9.990e-04 1.000e+03\n' \
        == render('$a {{b}} $CdeF $d $e $f', p), \
        'render converts float magically'