py4dstem / py4DSTEM

GNU General Public License v3.0
199 stars 135 forks source link

Show scalebar parameters don't take effect if ar.calibration is not None #672

Closed edwinsupple closed 2 days ago

edwinsupple commented 1 month ago

Describe the bug when using py4DSTEM.visualize.show, a dictionary passed to scalebar is ignored if the plotted image has a calibration parameter (e.g. virtual bright field images)

To Reproduce

import py4DSTEM
from py4DSTEM.visualize import show
import numpy as np

datacube = py4DSTEM.DataCube(np.random.rand(10,10,128,128))

datacube.calibration.set_Q_pixel_units('mrad') # arbitrary values to fill out calibration
datacube.calibration.set_Q_pixel_size(0.03)
datacube.calibration.set_R_pixel_units('nm')
datacube.calibration.set_R_pixel_size(3)

bf1 = datacube.get_virtual_image(mode='circle', geometry = ((64,64), 30))

show(bf1) # displays the default scalebar
show(bf1, scalebar={'position':'bl', 'color':'k'})  # scalebar still in same position and color as default

Expected behavior Would expect the default scalebar parameters to take effect, except for any that are passed to the function in the scalebar dictionary.

py4DSTEM version 0.14.15

Python version 3.10.4 Operating system Windows

Screenshots If applicable, could you add screenshots to help explain your problem? current functionality, showing parameter passed to scalebar as axis title: scalebar_functionality-old

expected behavior: scalebar_functionality-new

bsavitzky commented 2 days ago

Thank you Edwin!

On Thu, Sep 5, 2024 at 4:29 PM Edwin Supple @.***> wrote:

Closed #672 https://github.com/py4dstem/py4DSTEM/issues/672 as completed.

— Reply to this email directly, view it on GitHub https://github.com/py4dstem/py4DSTEM/issues/672#event-14152682928, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQYYNJ6QHEE63DJ4S6LNZLZVC5L7AVCNFSM6AAAAABKZSVIE6VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJUGE2TENRYGI4TEOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>