    

 ## On this page

  

 

 # Example 06: NSC Phase 

 Last update: 17.07.2025 

Ex 6: A file with a simple spherical wavefront is created using a point source, which propagates to a detector. Rather than using a Detector Viewer to extract the phase of the wavefront, the GetAllCoherentDataSafe() method is used to extract a 2D array to manually calculate the phase. The GetAllCoherentDataSafe() method will only return the real &amp; imaginary parts of the electric field, so atan2(image, real) is used to calculate the phase. Note that for C++, GetAllCoherentData() method is used to return a 1D array which is then read out in nested FOR loops and provides the 2D phase data in the correct orientation.

```
Input:      None
<p>Output:     Graph (Matlab, Python)
API\e06_nsc_phase.txt (C++, C#)
API\e06_nsc_phase.zos
</p>
```

[C#](page_ex06_cs.xhtml)

[C++](page_ex06_cpp.xhtml)

[Matlab](page_ex06_m.xhtml)

[Python](page_ex06_py.xhtml)