Ejemplo n.º 1
0
 def test_write_consistent(self):
   exporter=Exporter([self.ds.keys()[0]], [self.ref1])
   exporter.extract_reflectivity()
   expfile=os.path.join(tempfile.gettempdir(), 'testexport.dat')
   exporter.export_data(tempfile.gettempdir(), 'testexport.dat',
                     multi_ascii=True, combined_ascii=False,
                     matlab_data=False, numpy_data=False)
   tdata=array([self.ref1.Q, self.ref1.R, self.ref1.dR]).transpose()
   if sys.version_info[0]>=3:
     rdata=loadtxt(open(expfile, 'rb'))
   else:
     rdata=loadtxt(expfile)
   self.assertEqual(self.ref1.Q.shape[0], rdata.shape[0])
   testing.assert_allclose(rdata[:, 0], tdata[:, 0], rtol=1e-6, atol=1e-20, verbose=True)
   testing.assert_allclose(rdata[:, 1], tdata[:, 1], rtol=1e-6, atol=1e-20, verbose=True)
   testing.assert_allclose(rdata[:, 2], tdata[:, 2], rtol=1e-6, atol=1e-20, verbose=True)
   os.remove(expfile)
Ejemplo n.º 2
0
 def test_create_data(self):
   exporter=Exporter(self.ds.keys(), [self.ref1, self.ref2])
   exporter.extract_reflectivity()
   exporter.extract_offspecular()
   exporter.extract_offspecular_corr()
   exporter.smooth_offspec({
                          'grid': (20, 20),
                          'sigma': (3., 3.),
                          'sigmas': 3.,
                          'region': (10, 90, 5 , 95),
                          'xy_column': 0,
                          })
   exporter.smooth_offspec({
                          'grid': (20, 20),
                          'sigma': (3., 3.),
                          'sigmas': 3.,
                          'region': (10, 90, 5 , 95),
                          'xy_column': 1,
                          })
   exporter.smooth_offspec({
                          'grid': (20, 20),
                          'sigma': (3., 3.),
                          'sigmas': 3.,
                          'region': (10, 90, 5 , 95),
                          'xy_column': 2,
                          })
Ejemplo n.º 3
0
 def test_create_data(self):
     exporter = Exporter(self.ds.keys(), [self.ref1, self.ref2])
     exporter.extract_reflectivity()
     exporter.extract_offspecular()
     exporter.extract_offspecular_corr()
     exporter.smooth_offspec(
         {"grid": (20, 20), "sigma": (3.0, 3.0), "sigmas": 3.0, "region": (10, 90, 5, 95), "xy_column": 0}
     )
     exporter.smooth_offspec(
         {"grid": (20, 20), "sigma": (3.0, 3.0), "sigmas": 3.0, "region": (10, 90, 5, 95), "xy_column": 1}
     )
     exporter.smooth_offspec(
         {"grid": (20, 20), "sigma": (3.0, 3.0), "sigmas": 3.0, "region": (10, 90, 5, 95), "xy_column": 2}
     )
Ejemplo n.º 4
0
 def test_write_all(self):
   exporter=Exporter(self.ds.keys(), [self.ref1, self.ref2])
   exporter.extract_reflectivity()
   exporter.extract_offspecular()
   expfile=os.path.join(tempfile.gettempdir(), 'testexport.dat')
   if sys.version_info[0]<3:
     exporter.export_data(tempfile.gettempdir(), 'testexport.dat',
                       multi_ascii=True, combined_ascii=True,
                       matlab_data=True, numpy_data=True)
   else:
     # python3 from travis has problems with scipy, so we don't use matlab export
     exporter.export_data(tempfile.gettempdir(), 'testexport.dat',
                       multi_ascii=True, combined_ascii=True,
                       matlab_data=False, numpy_data=True)
   exporter.create_gnuplot_scripts(tempfile.gettempdir(), 'testexport.dat')
   exporter.create_genx_file(tempfile.gettempdir(), 'testexport.dat')
   os.remove(expfile)
Ejemplo n.º 5
0
 def test_write_all(self):
     exporter = Exporter(self.ds.keys(), [self.ref1, self.ref2])
     exporter.extract_reflectivity()
     exporter.extract_offspecular()
     expfile = os.path.join(tempfile.gettempdir(), "testexport.dat")
     exporter.export_data(
         tempfile.gettempdir(),
         "testexport.dat",
         multi_ascii=True,
         combined_ascii=True,
         matlab_data=True,
         numpy_data=True,
     )
     exporter.create_gnuplot_scripts(tempfile.gettempdir(), "testexport.dat")
     exporter.create_genx_file(tempfile.gettempdir(), "testexport.dat")
     os.remove(expfile)