Changeset 51bfbeb in sasmodels for sasmodels/generate.py


Ignore:
Timestamp:
Feb 19, 2015 8:50:11 AM (9 years ago)
Author:
ajj
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
12076cf
Parents:
efc517c
Message:

fixing polydispersity for models without it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    rff58110 r51bfbeb  
    503503    fn = q_pars['fn'] 
    504504 
    505     # Build polydispersity loops 
    506     depth = 4 
    507     offset = "" 
    508     loop_head = [] 
    509     loop_end = [] 
    510     for name in pd_pars: 
    511         subst = { 'name': name, 'offset': offset } 
    512         loop_head.append(indent(LOOP_OPEN%subst, depth)) 
    513         loop_end.insert(0, (" "*depth) + "}") 
    514         offset += '+N'+name 
    515         depth += 2 
     505    if len(pd_pars) > 0: 
     506        # Build polydispersity loops 
     507        depth = 4 
     508        offset = "" 
     509        loop_head = [] 
     510        loop_end = [] 
     511        for name in pd_pars: 
     512            subst = { 'name': name, 'offset': offset } 
     513            loop_head.append(indent(LOOP_OPEN%subst, depth)) 
     514            loop_end.insert(0, (" "*depth) + "}") 
     515            offset += '+N'+name 
     516            depth += 2 
    516517 
    517518    # The volume parameters in the inner loop are used to call the volume() 
Note: See TracChangeset for help on using the changeset viewer.