Commit c19ac5ea authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

resurrected dtr plot

parent 0a0cb0bc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -416,7 +416,7 @@ def add_transmission_options(subparser, parents=None):
def add_datreat_options(subparser, parents=None):
    "datreat options"
    pars = subparser.add_parser('datreat', parents=parents,
                      aliases=['dat',],
                      aliases=['dtr',],
                      help='datreat plot (drspine output)',
                      description='create datreat-type plot(s)')
    pars.add_argument('file', metavar='filename', help='file to process', nargs='+')
@@ -543,7 +543,7 @@ def main():
    # transmission plot
    add_transmission_options(subparsers, parents=[pars_com, pars_tof])
    # datreat plot
    #add_datreat_options(subparsers, parents=[pars_com])
    add_datreat_options(subparsers, parents=[pars_com])
    # map plot
    add_plotmap_options(subparsers, parents=[pars_com,])
    # magnetic field
@@ -569,7 +569,7 @@ def main():
                    xyz=action_xyz,
                    diffrun=action_diffrun, df=action_diffrun,
                    transmission=action_transmission, tr=action_transmission,
                    datreat=action_datreat, dat=action_datreat,
                    datreat=action_datreat, dtr=action_datreat,
                    qtau=action_qtau, qt=action_qtau,
                    phase_table=action_phase_table, pt=action_phase_table).get(args.command, None)
    if action is None:
+32 −8
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ def plot_xyz_single(hdfile, fig, axis, axis1=None, **kwargs):

    axis.set_title(label, fontsize=8)

    return dict(name=base, label=label, proton_charge=pcha,
    return dict(name=base, label=label, proton_charge=pcha, image=img,
                counts=np.sum(cnts), qave=(qave, qvar), lave=(lave, lvar),
                time=detector.attrs['preset'], qmin=q_min, lmax=lambda_max)

@@ -241,7 +241,7 @@ def plot_xyz(*hdfiles, **kwargs):
    title   = ''
    #
    fig = plt.figure(figsize=(9,9))
    gs = fig.add_gridspec(3,3)
    gs = fig.add_gridspec(4,3)
    fig.subplots_adjust(hspace=0.4, wspace=0.4)
    # axes mapping
    axes = {}
@@ -250,10 +250,10 @@ def plot_xyz(*hdfiles, **kwargs):

    log = logging.getLogger()
    #
    gs1 = gs[2,:].subgridspec(1,3)
    ax7 = fig.add_subplot(gs1[0])
    ax8 = fig.add_subplot(gs1[1] )
    ax9 = fig.add_subplot(gs1[2] )
    gs1 = gs[3,:].subgridspec(1,3)
    ax_xyz = fig.add_subplot(gs1[0])
    ax_lam = fig.add_subplot(gs1[1] )
    ax_q   = fig.add_subplot(gs1[2] )
    #
    for hfilename in hdfiles:
        log.info('processing %s', hfilename)
@@ -270,11 +270,35 @@ def plot_xyz(*hdfiles, **kwargs):
            axis1 = None
            if idx==(0,0):
                title = basename.replace(label,'')
                axis1=(ax8, ax9)
                axis1=(ax_lam, ax_q)
            res = plot_xyz_single(hdf5file, fig, ax, axis1=axis1, label=label, **kwargs)
            results.update({label:res})
    #
    xyz_analysis(results, ax7, norm=normalize, output=savefile, details=details)
    gsm = gs[2,0]
    axm = fig.add_subplot(gsm)

    dX  = results['x_up']['image'] + results['x_dn']['image']
    dY  = results['y_up']['image'] + results['y_dn']['image']
    dZ  = results['z_up']['image'] + results['z_dn']['image']
#    dX  = cnorm['x_up'] - cnorm['x_dn']
#    dY  = cnorm['y_up'] - cnorm['y_dn']
#    dZ  = cnorm['z_up'] - cnorm['z_dn']
#    #
#    sM_UP  = +2*cnorm['z_up'] - (cnorm['x_up'] + cnorm['y_up'])
#    sM_DN  = -2*cnorm['z_dn'] + (cnorm['x_dn'] + cnorm['y_dn'])
#    sTOT= (sUP + sDN)/3
    sM  =  2*dZ - (dX + dY)
    im = axm.imshow(sM , aspect='equal')
    fig.colorbar(im, ax=axm, use_gridspec=True)
#    sN  = (2*sUP - sDN)/6
#    sI  = sTOT - sN - sM

#    cnorm['m_mag'] = sM
#    cnorm['n_coh'] = sN
#    cnorm['i_inc'] = sI

    #
    xyz_analysis(results, ax_xyz, norm=normalize, output=savefile, details=details)

    #
    title = title.replace('_', ' ')
+2 −2
Original line number Diff line number Diff line
@@ -3,8 +3,8 @@ PySEN revision module
"""
import sys
__version__  = "1.3"
__release__  = "a1"
__date__     = "May 10, 2023"
__release__  = "a2"
__date__     = "June 1, 2023"

def version(full=False):
    "get pysen version number"