Question

How to extract the coherent irradiance from detector viewers through python?

  • 16 January 2024
  • 1 reply
  • 61 views

I need get the coherent irradiance from the detector viewer to see a laser behaviors inside of a glass.  The code i used is based on the python example code as:

Detector3D=np.zeros((100,100,100))

 for i in range(1,101):
    D_num=11+i
    d_test= TheSystem.Analyses.New_Analysis(constants.AnalysisIDM_DetectorViewer)
    d_set = d_test.GetSettings()
    setting = CastTo(d_set, 'IAS_DetectorViewer')
    setting.Detector.SetDetectorNumber(D_num)
    setting.ShowAs = constants.DetectorViewerShowAsTypes_FalseColor
    d_test.ApplyAndWaitForCompletion()
    d_test_results = d_test.GetResults()
    results = CastTo(d_test_results, 'IAR_')
    d_test_values = results.GetDataGrid(0).Values
    Detector3D[:][:][i-1]=np.flipud(np.array(d_test_values))

    d_test.close()

 

unfortunately, this code only give me the incoherent irradiance. My question is how can i set the “show data type” to “ coherent irradiance” or coherent phase” in python code?

 


1 reply

It works after add “setting.DataType = constants.DetectorViewerShowDataTypes_CoherentIrradiance” as:

    Detector3D=np.zeros((100,100,100))

    for ii in range(1,101):
        D_num=11+ii
        d_test= TheSystem.Analyses.New_Analysis(constants.AnalysisIDM_DetectorViewer)
        d_set = d_test.GetSettings()
        setting = CastTo(d_set, 'IAS_DetectorViewer')
        setting.Detector.SetDetectorNumber(D_num)
        setting.ShowAs = constants.DetectorViewerShowAsTypes_FalseColor
        setting.DataType = constants.DetectorViewerShowDataTypes_CoherentIrradiance
        d_test.ApplyAndWaitForCompletion()
        d_test_results = d_test.GetResults()
        results = CastTo(d_test_results, 'IAR_')
        d_test_values = results.GetDataGrid(0).Values
        Detector3D[:][:][i-1]=np.flipud(np.array(d_test_values))
        d_test.Close()

 

Reply