From: <rw...@us...> - 2012-03-31 20:49:22
|
Revision: 15223 http://cctbx.svn.sourceforge.net/cctbx/?rev=15223&view=rev Author: rwgk Date: 2012-03-31 20:49:15 +0000 (Sat, 31 Mar 2012) Log Message: ----------- rstbx/simage/wx_display.py: toggle image between wavelength and wavelength_2 Modified Paths: -------------- trunk/rstbx/command_line/simage.create.py trunk/rstbx/simage/create.py trunk/rstbx/simage/wx_display.py Modified: trunk/rstbx/command_line/simage.create.py =================================================================== --- trunk/rstbx/command_line/simage.create.py 2012-03-31 20:22:43 UTC (rev 15222) +++ trunk/rstbx/command_line/simage.create.py 2012-03-31 20:49:15 UTC (rev 15223) @@ -1,12 +1,7 @@ def run(args): from rstbx.simage import create from scitbx.array_family import flex - work_params = create.process_args( - args=args, - extra_phil_str="""\ -wavelength_2 = None - .type = float -""") + work_params = create.process_args(args=args) i_calc, image_info = create.compute( work_params=work_params, store_miller_index_i_seqs=True, @@ -21,9 +16,9 @@ print "%3d %3d %3d" % h, "(%8.2f, %8.2f)" % tuple(x[:2]), "%.6g" % s print else: - work_params.wavelength = work_params.wavelength_2 i_calc_2, image_info_2 = create.compute( work_params=work_params, + use_wavelength_2=True, store_miller_index_i_seqs=True, store_spots=True, store_signals=True) Modified: trunk/rstbx/simage/create.py =================================================================== --- trunk/rstbx/simage/create.py 2012-03-31 20:22:43 UTC (rev 15222) +++ trunk/rstbx/simage/create.py 2012-03-31 20:49:15 UTC (rev 15223) @@ -25,6 +25,8 @@ .type = floats(size=9) wavelength = 1 .type = float +wavelength_2 = None + .type = float d_min = 2 .type = float ewald_proximity = 0.0025 @@ -255,6 +257,7 @@ def compute( work_params, + use_wavelength_2=False, store_miller_index_i_seqs=False, store_spots=False, store_signals=False, @@ -263,6 +266,10 @@ from scitbx.math.euler_angles import xyz_matrix crystal_rotation_matrix = xyz_matrix(*work_params.euler_angles_xyz) work_params.crystal_rotation_matrix = crystal_rotation_matrix + if (not use_wavelength_2): + wavelength = work_params.wavelength + else: + wavelength = work_params.wavelength_2 from rstbx.simage import image_simple return i_calc, image_simple( store_miller_index_i_seqs=store_miller_index_i_seqs, @@ -273,7 +280,7 @@ miller_indices=i_calc.p1_anom.indices(), spot_intensity_factors=i_calc.p1_anom.data(), crystal_rotation_matrix=crystal_rotation_matrix, - ewald_radius=1/work_params.wavelength, + ewald_radius=1/wavelength, ewald_proximity=work_params.ewald_proximity, signal_max=work_params.signal_max, detector_distance=work_params.detector.distance, @@ -282,8 +289,11 @@ point_spread=work_params.point_spread, gaussian_falloff_scale=work_params.gaussian_falloff_scale) -def compute_image(work_params): - _, image_info = compute(work_params=work_params, set_pixels=True) +def compute_image(work_params, use_wavelength_2=False): + _, image_info = compute( + work_params=work_params, + use_wavelength_2=use_wavelength_2, + set_pixels=True) pixels = image_info.pixels add_noise(work_params, pixels=pixels) return pixels Modified: trunk/rstbx/simage/wx_display.py =================================================================== --- trunk/rstbx/simage/wx_display.py 2012-03-31 20:22:43 UTC (rev 15222) +++ trunk/rstbx/simage/wx_display.py 2012-03-31 20:49:15 UTC (rev 15223) @@ -15,8 +15,10 @@ O.prev_work_phil_str = None O.pixels = None O.image = None + O.image_2 = None O.spots = None O.predicted_spots = None + O.image_toggle = False def recompute(O): w, h = O.GetSizeTuple() @@ -39,6 +41,10 @@ O.pixels = compute_image(O.work_params) O.image = O.pixels.as_rgb_gray_scale_string( saturation=O.work_params.signal_max) + if (O.work_params.wavelength_2 is not None): + pixels_2 = compute_image(O.work_params, use_wavelength_2=True) + O.image_2 = pixels_2.as_rgb_gray_scale_string( + saturation=O.work_params.signal_max) if ( O.prev_work_phil_ewp_none_str is None or O.prev_work_phil_ewp_none_str != work_phil_ewp_none_str): O.prev_work_phil_ewp_none_str = work_phil_ewp_none_str @@ -142,7 +148,9 @@ assert p != 0 wx_image = wx.EmptyImage(p, p) if (O.image is not None): - wx_image.SetData(O.image) + if (not O.image_toggle): im = O.image + else: im = O.image_2 + wx_image.SetData(im) wx_bitmap = wx_image.ConvertToBitmap() dc = wx.PaintDC(win=O) dc = wx.BufferedDC(dc) @@ -179,7 +187,11 @@ def OnChar(O, event): key = event.GetKeyCode() - if (key == ord("s")): + if (key == ord("w")): + if (O.image_2 is not None): + O.image_toggle = not O.image_toggle + O.Refresh() + elif (key == ord("s")): O.run_spotfinder() elif (key == ord("i")): O.predicted_spots = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |