@@ -488,107 +488,6 @@ def test_integrate1d_horizontal_deprecated_units(self):
488488 self .assertFalse (abs (res1d_ref .radial - res1d_deprecated .radial ).max (), 0 )
489489 self .assertFalse (abs (res1d_ref .intensity - res1d_deprecated .intensity ).max (), 0 )
490490
491- def test_sample_orientation_equivalence (self ):
492- incident_angle = 0.0
493- tilt_angle = 0.0
494- npt_ip = 100
495- npt_oop = 100
496-
497- threshold = 1.0
498-
499- sample_orientation = 1
500- oop_range_1 = [- 5 ,5 ]
501- ip_range_1 = [0 ,20 ]
502- res_so_1 = self .fi .integrate_grazing_incidence (data = self .data , npt_ip = npt_ip , npt_oop = npt_oop ,
503- ip_range = ip_range_1 , oop_range = oop_range_1 ,
504- incident_angle = incident_angle , tilt_angle = tilt_angle ,
505- sample_orientation = sample_orientation ,
506- vertical_integration = False ,
507- )
508-
509- sample_orientation = 2
510- ip_range_2 = [- 5 ,5 ]
511- oop_range_2 = [0 ,20 ]
512- res_so_2 = self .fi .integrate_grazing_incidence (data = self .data , npt_ip = npt_ip , npt_oop = npt_oop ,
513- ip_range = ip_range_2 , oop_range = oop_range_2 ,
514- incident_angle = incident_angle , tilt_angle = tilt_angle ,
515- sample_orientation = sample_orientation ,
516- vertical_integration = True ,
517- )
518-
519- self .assertLess ((abs (res_so_1 .intensity ) - abs (res_so_2 .intensity )).max (), threshold )
520-
521- sample_orientation = 3
522- oop_range_3 = [- 5 ,5 ]
523- ip_range_3 = [- 20 ,0 ]
524- res_so_3 = self .fi .integrate_grazing_incidence (data = self .data , npt_ip = npt_ip , npt_oop = npt_oop ,
525- ip_range = ip_range_3 , oop_range = oop_range_3 ,
526- incident_angle = incident_angle , tilt_angle = tilt_angle ,
527- sample_orientation = sample_orientation ,
528- vertical_integration = False ,
529- )
530-
531- self .assertLess ((abs (res_so_3 .intensity ) - abs (res_so_2 .intensity )).max (), threshold )
532-
533- sample_orientation = 4
534- oop_range_4 = [- 20 ,5 ]
535- ip_range_4 = [- 5 ,5 ]
536- res_so_4 = self .fi .integrate_grazing_incidence (data = self .data , npt_ip = npt_ip , npt_oop = npt_oop ,
537- ip_range = ip_range_4 , oop_range = oop_range_4 ,
538- incident_angle = incident_angle , tilt_angle = tilt_angle ,
539- sample_orientation = sample_orientation ,
540- vertical_integration = True ,
541- )
542-
543- self .assertLess ((abs (res_so_4 .intensity ) - abs (res_so_3 .intensity )).max (), threshold )
544-
545- def test_numexpr_equations (self ):
546- incident_angle = 0.2
547- tilt_angle = - 1.0
548- sample_orientation = 3
549-
550- qhorz = get_unit_fiber (name = "qxgi_nm^-1" , incident_angle = incident_angle , tilt_angle = tilt_angle , sample_orientation = sample_orientation )
551- qvert = get_unit_fiber (name = "qygi_nm^-1" , incident_angle = incident_angle , tilt_angle = tilt_angle , sample_orientation = sample_orientation )
552- qbeam = get_unit_fiber (name = "qzgi_nm^-1" , incident_angle = incident_angle , tilt_angle = tilt_angle , sample_orientation = sample_orientation )
553- qip = get_unit_fiber (name = "qip_nm^-1" , incident_angle = incident_angle , tilt_angle = tilt_angle , sample_orientation = sample_orientation )
554- qoop = get_unit_fiber (name = "qoop_nm^-1" , incident_angle = incident_angle , tilt_angle = tilt_angle , sample_orientation = sample_orientation )
555-
556- self .fi .reset ()
557- arr_qhorz_fast = self .fi .array_from_unit (unit = qhorz )
558- arr_qvert_fast = self .fi .array_from_unit (unit = qvert )
559- arr_qbeam_fast = self .fi .array_from_unit (unit = qbeam )
560- arr_qip_fast = self .fi .array_from_unit (unit = qip )
561- arr_qoop_fast = self .fi .array_from_unit (unit = qoop )
562- res2d_fast = self .fi .integrate2d_grazing_incidence (data = self .data , unit_ip = qip , unit_oop = qoop )
563-
564- qhorz .formula = None
565- qhorz .equation = qhorz ._equation
566- qvert .formula = None
567- qvert .equation = qvert ._equation
568- qbeam .formula = None
569- qbeam .equation = qbeam ._equation
570- qip .formula = None
571- qip .equation = qip ._equation
572- qoop .formula = None
573- qoop .equation = qoop ._equation
574-
575- self .fi .reset ()
576- arr_qhorz_slow = self .fi .array_from_unit (unit = qhorz )
577- arr_qvert_slow = self .fi .array_from_unit (unit = qvert )
578- arr_qbeam_slow = self .fi .array_from_unit (unit = qbeam )
579- arr_qip_slow = self .fi .array_from_unit (unit = qip )
580- arr_qoop_slow = self .fi .array_from_unit (unit = qoop )
581- res2d_slow = self .fi .integrate2d_grazing_incidence (data = self .data , unit_ip = qip , unit_oop = qoop )
582-
583- self .assertAlmostEqual ((arr_qhorz_fast - arr_qhorz_slow ).max (), 0.0 )
584- self .assertAlmostEqual ((arr_qvert_fast - arr_qvert_slow ).max (), 0.0 )
585- self .assertAlmostEqual ((arr_qbeam_fast - arr_qbeam_slow ).max (), 0.0 )
586- self .assertAlmostEqual ((arr_qip_fast - arr_qip_slow ).max (), 0.0 )
587- self .assertAlmostEqual ((arr_qoop_fast - arr_qoop_slow ).max (), 0.0 )
588- self .assertAlmostEqual ((res2d_fast .intensity - res2d_slow .intensity ).max (), 0.0 )
589- self .assertAlmostEqual ((res2d_fast .radial - res2d_slow .radial ).max (), 0.0 )
590- self .assertAlmostEqual ((res2d_fast .azimuthal - res2d_slow .azimuthal ).max (), 0.0 )
591-
592491def suite ():
593492 testsuite = unittest .TestSuite ()
594493 loader = unittest .defaultTestLoader .loadTestsFromTestCase
0 commit comments