Changeset 51f14603 in sasview for src/sans/data_util


Ignore:
Timestamp:
Apr 3, 2014 11:37:53 AM (11 years ago)
Author:
Peter Parker
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
2f2d9d0
Parents:
eea3ffa
Message:

Refs #202 - Fix Sphinx build errors (not including park-1.2.1/). Most warnings remain.

Location:
src/sans/data_util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sans/data_util/calcthread.py

    r4bae1ef r51f14603  
    3333     
    3434    When defining the compute() method you need to include code which 
    35     allows the GUI to run.  They are as follows: 
    36         self.isquit()          call frequently to check for interrupts 
    37         self.update(kw=...)    call when the GUI could be updated 
    38         self.complete(kw=...)  call before exiting compute() 
     35    allows the GUI to run.  They are as follows: :: 
     36 
     37        self.isquit()          # call frequently to check for interrupts 
     38        self.update(kw=...)    # call when the GUI could be updated 
     39        self.complete(kw=...)  # call before exiting compute() 
     40 
    3941    The update() and complete() calls accept field=value keyword 
    4042    arguments which are passed to the called function.  complete() 
     
    4648    of the derived class. 
    4749 
    48     The user of this class will call the following: 
    49  
    50         thread = Work(...,kw=...)  prepare the work thread. 
    51         thread.queue(...,kw=...)   queue a work unit 
    52         thread.requeue(...,kw=...) replace work unit on the end of queue 
    53         thread.reset(...,kw=...)   reset the queue to the given work unit 
    54         thread.stop()              clear the queue and halt 
    55         thread.interrupt()         halt the current work unit but continue 
    56         thread.ready(delay=0.)     request an update signal after delay 
    57         thread.isrunning()         returns true if compute() is running 
     50    The user of this class will call the following: :: 
     51 
     52        thread = Work(...,kw=...)  # prepare the work thread. 
     53        thread.queue(...,kw=...)   # queue a work unit 
     54        thread.requeue(...,kw=...) # replace work unit on the end of queue 
     55        thread.reset(...,kw=...)   # reset the queue to the given work unit 
     56        thread.stop()              # clear the queue and halt 
     57        thread.interrupt()         # halt the current work unit but continue 
     58        thread.ready(delay=0.)     # request an update signal after delay 
     59        thread.isrunning()         # returns true if compute() is running 
    5860 
    5961    Use queue() when all work must be done.  Use requeue() when intermediate 
     
    6365    stop() to halt the current and pending computations (e.g., in response to 
    6466    a stop button). 
    65      
     67 
    6668    The methods queue(), requeue() and reset() are proxies for the compute() 
    6769    method in the subclass.  Look there for a description of the arguments. 
     
    8284    should be implemented vary from framework to framework. 
    8385 
    84     For wx, something like the following is needed: 
     86    For wx, something like the following is needed: :: 
    8587 
    8688        import wx, wx.lib.newevent 
  • src/sans/data_util/registry.py

    r4bae1ef r51f14603  
    1515    Note that there may be multiple loaders for the same extension. 
    1616 
    17     Example: 
     17    Example: :: 
    1818 
    19     registry = ExtensionRegistry() 
     19        registry = ExtensionRegistry() 
    2020 
    21     # Add an association by setting an element 
    22     registry['.zip'] = unzip 
    23      
    24     # Multiple extensions for one loader 
    25     registry['.tgz'] = untar 
    26     registry['.tar.gz'] = untar 
     21        # Add an association by setting an element 
     22        registry['.zip'] = unzip 
     23         
     24        # Multiple extensions for one loader 
     25        registry['.tgz'] = untar 
     26        registry['.tar.gz'] = untar 
    2727 
    28     # Generic extensions to use after trying more specific extensions;  
    29     # these will be checked after the more specific extensions fail. 
    30     registry['.gz'] = gunzip 
     28        # Generic extensions to use after trying more specific extensions;  
     29        # these will be checked after the more specific extensions fail. 
     30        registry['.gz'] = gunzip 
    3131 
    32     # Multiple loaders for one extension 
    33     registry['.cx'] = cx1 
    34     registry['.cx'] = cx2 
    35     registry['.cx'] = cx3 
     32        # Multiple loaders for one extension 
     33        registry['.cx'] = cx1 
     34        registry['.cx'] = cx2 
     35        registry['.cx'] = cx3 
    3636 
    37     # Show registered extensions 
    38     print registry.extensions() 
    39      
    40     # Can also register a format name for explicit control from caller 
    41     registry['cx3'] = cx3 
    42     print registry.formats() 
     37        # Show registered extensions 
     38        print registry.extensions() 
     39         
     40        # Can also register a format name for explicit control from caller 
     41        registry['cx3'] = cx3 
     42        print registry.formats() 
    4343 
    44     # Retrieve loaders for a file name 
    45     registry.lookup('hello.cx') -> [cx3,cx2,cx1] 
     44        # Retrieve loaders for a file name 
     45        registry.lookup('hello.cx') -> [cx3,cx2,cx1] 
    4646 
    47     # Run loader on a filename 
    48     registry.load('hello.cx') -> 
    49         try: 
     47        # Run loader on a filename 
     48        registry.load('hello.cx') -> 
     49            try: 
     50                return cx3('hello.cx') 
     51            except: 
     52                try: 
     53                    return cx2('hello.cx') 
     54                except: 
     55                    return cx1('hello.cx') 
     56 
     57        # Load in a specific format ignoring extension 
     58        registry.load('hello.cx',format='cx3') -> 
    5059            return cx3('hello.cx') 
    51         except: 
    52             try: 
    53                 return cx2('hello.cx') 
    54             except: 
    55                 return cx1('hello.cx') 
    56  
    57     # Load in a specific format ignoring extension 
    58     registry.load('hello.cx',format='cx3') -> 
    59         return cx3('hello.cx') 
    6060    """ 
    6161    def __init__(self, **kw): 
Note: See TracChangeset for help on using the changeset viewer.