Changeset 3d7f364 in sasmodels


Ignore:
Timestamp:
Feb 14, 2019 9:57:27 AM (5 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
275511c
Parents:
9ec9c67
Message:

tweak web jitter viewer details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/jitter.py

    r9ec9c67 r3d7f364  
    7777    # TODO: draw endcaps on beam 
    7878    ## Draw tiny balls on the end will work 
    79     #draw_sphere(axes, radius=0.02, center=(0, 0, 1.3), color='yellow') 
    80     #draw_sphere(axes, radius=0.02, center=(0, 0, -1.3), color='yellow') 
     79    draw_sphere(axes, radius=0.02, center=(0, 0, 1.3), color='yellow') 
     80    draw_sphere(axes, radius=0.02, center=(0, 0, -1.3), color='yellow') 
    8181    ## The following does not work 
    8282    #triangles = [(0, i+1, i+2) for i in range(steps-2)] 
     
    295295    Represent jitter as a set of shapes at different orientations. 
    296296    """ 
    297     project, weight = get_projection(projection) 
     297    project, project_weight = get_projection(projection) 
    298298 
    299299    # set max diagonal to 0.95 
     
    304304    base = {'gaussian':3, 'rectangle':sqrt(3), 'uniform':1}[dist] 
    305305    def steps(delta): 
    306         limit = base*delta 
    307306        if views is None: 
    308307            n = max(3, min(25, 2*int(base*delta/5))) 
    309308        else: 
    310309            n = views 
    311         s = base*delta*np.linspace(-1, 1, n) if delta > 0 else [0] 
    312         return s 
    313     stheta = steps(dtheta) 
    314     sphi = steps(dphi) 
    315     spsi = steps(dpsi) 
    316     #print(stheta, sphi, spsi) 
    317     for theta in stheta: 
    318         for phi in sphi: 
    319             for psi in spsi: 
    320                 w = weight(theta, phi, 1.0, 1.0) 
     310        return base*delta*np.linspace(-1, 1, n) if delta > 0 else [0.] 
     311    for theta in steps(dtheta): 
     312        for phi in steps(dphi): 
     313            for psi in steps(dpsi): 
     314                w = project_weight(theta, phi, 1.0, 1.0) 
    321315                if w > 0: 
    322316                    dview = project(theta, phi, psi) 
     
    782776        vmin = vmax*10**-7 
    783777        #vmin, vmax = clipped_range(Iqxy, portion=portion, mode='top') 
     778    #vmin, vmax = Iqxy.min(), Iqxy.max() 
    784779    #print("range",(vmin,vmax)) 
    785780    #qx, qy = np.meshgrid(qx, qy) 
     
    791786        #colors = cm.coolwarm(level) 
    792787        #colors = cm.gist_yarg(level) 
     788        #colors = cm.Wistia(level) 
     789        colors[level<=0, 3] = 0.  # set floor to transparent 
    793790        x, y = np.meshgrid(qx/qx.max(), qy/qy.max()) 
    794791        axes.plot_surface(x, y, -1.1*np.ones_like(x), facecolors=colors) 
     
    955952 
    956953    # set up calculator 
    957     calculator, size = select_calculator(model_name, n=100, size=size) 
     954    calculator, size = select_calculator(model_name, n=150, size=size) 
    958955    draw_shape = DRAW_SHAPES.get(model_name, draw_parallelepiped) 
    959956    #draw_shape = draw_fcc 
     
    11181115        color = kw['color'] 
    11191116        #TODO: convert color to [r, g, b, a] if not already 
     1117        if isinstance(color, (tuple, list)): 
     1118            if len(color) == 3: 
     1119                color = (color[0], color[1], color[2], alpha) 
     1120            else: 
     1121                color = (color[0], color[1], color[2], alpha*color[3]) 
     1122            color = np.array(color) 
    11201123        if isinstance(color, np.ndarray) and color.shape[-1] == 4: 
    11211124            color[..., 3] = alpha 
     
    11571160            h = ipv.plot_surface(x, y, z, **kw) 
    11581161            ipv_set_transparency(kw, h) 
     1162            #h.material.side = "DoubleSide" 
    11591163            return h 
    11601164        def plot_trisurf(self, x, y, triangles=None, Z=None, **kw): 
     
    11891193            h = ipv.plot_mesh(x, y, z, u=u, v=v, texture=image, wireframe=False) 
    11901194            ipv_set_transparency(kw, h) 
     1195            h.material.side = "DoubleSide" 
    11911196            return h 
    11921197        def text(self, *args, **kw): 
     
    12311236 
    12321237        ## Move shape and draw scattering 
    1233         draw_beam(axes, (0, 0)) 
    1234         draw_jitter(axes, view, jitter, dist=dist, size=size, 
     1238        draw_beam(axes, (0, 0), steps=25) 
     1239        draw_jitter(axes, view, jitter, dist=dist, size=size, alpha=1.0, 
    12351240                    draw_shape=draw_shape, projection=projection) 
    1236         draw_mesh(axes, view, jitter, dist=dist, n=mesh, radius=0.95, projection=projection) 
     1241        draw_mesh(axes, view, jitter, dist=dist, n=mesh, radius=0.95, 
     1242                  projection=projection) 
    12371243        draw_scattering(calculator, axes, view, jitter, dist=dist) 
    12381244 
Note: See TracChangeset for help on using the changeset viewer.