Changeset 084afb4 in sasview


Ignore:
Timestamp:
Apr 4, 2014 5:16:11 PM (11 years ago)
Author:
pkienzle
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:
da5d8e8
Parents:
c5442fb
Message:

fix random initial conditions for infinite ranges in amoeba fit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park-1.2.1/park/fitmc.py

    r3570545 r084afb4  
    147147    See `park.fitresult.FitHandler` for details. 
    148148    """ 
     149    # Generate random number within bounds.  If bounds are indefinite, use [0,1] 
     150    # If bounds are semi-definite, use [low,low+1] or [high-1,high], depending 
     151    # on which limit is unbounded. 
    149152    lo,hi = bounds 
     153    inf_lo = numpy.isinf(lo) 
     154    inf_hi = numpy.isinf(hi) 
    150155    delta = hi-lo 
    151     delta[numpy.isinf(delta)] = 1 
    152     lo[numpy.isinf(lo)] = hi-1 
    153     lo[numpy.isinf(lo)] = 0 
     156    delta[inf_lo|inf_hi] = 1.0 
     157    lo[inf_lo] = hi[inf_lo] - 1.0 
     158    lo[inf_lo&inf_hi] = 0.0 
    154159    P = numpy.random.rand(n,len(x0))*delta+lo 
    155160    #print "Population",P 
    156161    P[0] = x0 
     162 
    157163    pmap.pmapreduce(MapMC(localfit,fitness), 
    158164                    CollectMC(n,handler), 
Note: See TracChangeset for help on using the changeset viewer.