Changeset 0f65169 in sasmodels


Ignore:
Timestamp:
Nov 1, 2017 3:00:39 AM (7 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:
bc386f0
Parents:
d73a5ac
git-author:
Paul Kienzle <pkienzle@…> (11/01/17 02:36:57)
git-committer:
Paul Kienzle <pkienzle@…> (11/01/17 03:00:39)
Message:

Add Guyou projection to jitter options

Location:
explore
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • explore/jitter.py

    rd73a5ac r0f65169  
    162162 
    163163PROJECTIONS = [ 
    164     'equirectangular', 'azimuthal_equidistance', 'sinusoidal', 
     164    'equirectangular', 'azimuthal_equidistance', 'sinusoidal', 'guyou', 
    165165] 
    166166def draw_mesh(ax, view, jitter, radius=1.2, n=11, dist='gaussian', 
     
    204204        from theta at 90+dt winding backwards around the pole, overlapping 
    205205        the circle from theta at 90-dt. 
    206     Guyour (hemisphere-in-a-square)  **not implemented** 
     206    Guyou (hemisphere-in-a-square) **not weighted** 
    207207        <https://en.wikipedia.org/wiki/Guyou_hemisphere-in-a-square_projection> 
    208         Promising.  With tiling should allow rotation in phi or theta 
    209         through +/- 180, preserving almost disk-like behaviour in either 
    210         direction (phi rotation will not be as uniform as it is in 
    211         equirectangular; not sure about theta).  Unfortunately, distortion 
    212         is not restricted to the corners of the theta-phi mesh, so this will 
    213         not be as good as the azimuthal equidistance project for gaussian 
    214         distributions. 
     208        With tiling, allows rotation in phi or theta through +/- 180, with 
     209        uniform spacing.  Both theta and phi allow free rotation, with wobble 
     210        in the orthogonal direction reasonably well behaved (though not as 
     211        good as equirectangular phi). The forward/reverse transformations 
     212        relies on elliptic integrals that are somewhat expensive, so the 
     213        behaviour has to be very good to justify the cost and complexity. 
     214        The weighting function for each point has not yet been computed. 
     215        Note: run the module *guyou.py* directly and it will show the forward 
     216        and reverse mappings. 
    215217    azimuthal_equal_area  **incomplete** 
    216218        <https://en.wikipedia.org/wiki/Lambert_azimuthal_equal-area_projection> 
     
    303305            w = sin(radians(latitude))/latitude if latitude != 0 else 1 
    304306            return w*wi*wj if latitude < 180 else 0 
     307    elif projection == 'guyou': 
     308        def rotate(theta_i, phi_j): 
     309            from guyou import guyou_invert 
     310            #latitude, longitude = guyou_invert([theta_i], [phi_j]) 
     311            longitude, latitude = guyou_invert([phi_j], [theta_i]) 
     312            return Rx(longitude[0])*Ry(latitude[0]) 
     313        def weight(theta_i, phi_j, wi, wj): 
     314            return wi*wj 
    305315    else: 
    306316        raise ValueError("unknown projection %r"%projection) 
Note: See TracChangeset for help on using the changeset viewer.