|
430 | 430 |
|
431 | 431 | PulsePhaseRotate[pulse_,\[Phi]_]:=
|
432 | 432 | Module[{xy=pulse[Pulse],a\[Theta]},
|
433 |
| - a\[Theta]={Norm/@xy,\[Phi]+(ArcTan[First@#,Last@#]&/@xy)}\[Transpose]; |
| 433 | + a\[Theta]={Norm/@xy,\[Phi]+(If[First@#==0&&Last@#==0,0,ArcTan[First@#,Last@#]]&/@xy)}\[Transpose]; |
434 | 434 | xy={First[#]Cos[Last@#],First[#]Sin[Last@#]}&/@a\[Theta];
|
435 | 435 | PulseReplaceKey[pulse,Pulse,xy]
|
436 | 436 | ]
|
|
486 | 486 | Module[{\[Sigma],NI,fun,pulse},
|
487 | 487 | \[Sigma]=riseTime/3;
|
488 | 488 | fun[t_]:=Piecewise[{{1,riseTime<t<T-riseTime},{Exp[-(t-riseTime)^2/(2\[Sigma]^2)],t<=riseTime},{Exp[-(t-T+riseTime)^2/(2\[Sigma]^2)],t>=T-riseTime}}];
|
489 |
| - NI=NIntegrate[fun[t],{t,0,T}]; |
490 |
| - pulse=Table[{area*fun[t-dt/2]/NI,0},{t,0,T,dt}]; |
491 |
| - (*Correct the area now that we have a descent shape*) |
492 |
| - pulse=area*pulse/(dt*Total@Flatten@pulse); |
| 489 | + If[area!=0, |
| 490 | + NI=NIntegrate[fun[t],{t,0,T}]; |
| 491 | + pulse=Table[{area*fun[t-dt/2]/NI,0},{t,0,T,dt}]; |
| 492 | + (*Correct the area now that we have a descent shape*) |
| 493 | + pulse=area*pulse/(dt*Total@Flatten@pulse);, |
| 494 | + pulse=Table[{0,0},{t,0,T,dt}]; |
| 495 | + ]; |
493 | 496 | AddTimeSteps[dt, pulse]
|
494 | 497 | ];
|
495 | 498 | GaussianTailsPulse[dt_,T_,riseTime_,Max->max_]:=Module[
|
|
0 commit comments