Ignore:
Timestamp:
01/18/13 06:20:57 (3 years ago)
Author:
mmckerns
Message:

moved discrete from decorate/wrapper to mystic.constraints;
added impose_reweighted_mean and impose_reweighted_variance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/decorate/test_wrapper.py

    r629 r646  
    126126 
    127127 
    128 def test_discrete(): 
    129  
    130   @discrete([1.0, 3.5, 5.5, 7.0]) 
    131   def discrete_squared(x): 
    132     return x**2 
    133  
    134   assert discrete_squared(5.6) == 5.5**2 
    135   assert all(discrete_squared(asarray([1, 3])) == asarray([1.0, 3.5])**2) 
    136   discrete_squared.samples([1.0, 7.0]) 
    137   assert discrete_squared(5.6) == 7.0**2 
    138   discrete_squared.index([0, -1]) 
    139   assert all(discrete_squared(asarray([0, 3, 6])) == asarray([1.0, 3.0, 7.0])**2) 
    140  
    141  
    142128if __name__ == '__main__': 
    143129  test_monitored() 
     
    146132  test_bounded() 
    147133  test_mixedin() 
    148   test_discrete() 
    149134  test_clip_bounded() 
    150135  test_target_bounded() 
Note: See TracChangeset for help on using the changeset viewer.