Changeset 09e9e13 in sasmodels


Ignore:
Timestamp:
Apr 11, 2017 10:43:35 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
1a4d4c0
Parents:
1cd24b4
Message:

improve plots for sasmodels driven by bumps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/data.py

    ra769b54 r09e9e13  
    450450            if view is 'log': 
    451451                mtheory[mtheory <= 0] = masked 
    452             plt.plot(data.x, scale*mtheory, '-', hold=True) 
     452            plt.plot(data.x, scale*mtheory, '-') 
    453453            all_positive = all_positive and (mtheory > 0).all() 
    454454            some_present = some_present or (mtheory.count() > 0) 
     
    457457            plt.ylim(*limits) 
    458458 
    459         plt.xscale('linear' if not some_present or non_positive_x  else view) 
     459        plt.xscale('linear' if not some_present or non_positive_x 
     460                   else view if view is not None 
     461                   else 'log') 
    460462        plt.yscale('linear' 
    461463                   if view == 'q4' or not some_present or not all_positive 
    462                    else view) 
     464                   else view if view is not None 
     465                   else 'log') 
    463466        plt.xlabel("$q$/A$^{-1}$") 
    464467        plt.ylabel('$I(q)$') 
     468        title = ("data and model" if use_theory and use_data 
     469                 else "data" if use_data 
     470                 else "model") 
     471        plt.title(title) 
    465472 
    466473    if use_calc: 
     
    482489        if num_plots > 1: 
    483490            plt.subplot(1, num_plots, use_calc + 2) 
    484         plt.plot(data.x, mresid, '-') 
     491        plt.plot(data.x, mresid, '.') 
    485492        plt.xlabel("$q$/A$^{-1}$") 
    486493        plt.ylabel('residuals') 
    487         plt.xscale('linear' if not some_present or non_positive_x else view) 
     494        plt.xscale('linear') 
     495        plt.title('(model - Iq)/dIq') 
    488496 
    489497 
     
    512520        if theory is not None: 
    513521            if is_tof: 
    514                 plt.plot(data.x, np.log(theory)/(data.lam*data.lam), '-', hold=True) 
     522                plt.plot(data.x, np.log(theory)/(data.lam*data.lam), '-') 
    515523            else: 
    516                 plt.plot(data.x, theory, '-', hold=True) 
     524                plt.plot(data.x, theory, '-') 
    517525        if limits is not None: 
    518526            plt.ylim(*limits) 
Note: See TracChangeset for help on using the changeset viewer.