APS-4ID-POLAR / polartools

Python package to read and process data from the APS Polar beamline.
https://polartools.readthedocs.io/en/latest/
Other
2 stars 2 forks source link

read_mesh #42

Closed strempfer closed 3 years ago

strempfer commented 3 years ago

add read_mesh to plot_2d

strempfer commented 3 years ago

I added the possibility to load a mesh scan in plot_2d. Are there mesh scans already available in Bluesky? This could be added as well then.

prjemian commented 3 years ago

list of different bluesky mesh scans: https://blueskyproject.io/bluesky/search.html?q=grid_scan&check_keywords=yes&area=default

gfabbris commented 3 years ago

I'll try to run a dummy mesh scan at 4-ID-D today, then you'll have a reference. But information on the x/y motors should appear in the hints.

gfabbris commented 3 years ago

@strempfer - I did a dummy mesh scan in bluesky (scan_id = 416):

BlueskyRun
  uid='c562a8bb-e47d-4cea-80c5-7967dd466e58'
  exit_status='success'
  2021-03-22 17:45:49.268 -- 2021-03-22 17:47:08.780
  Streams:
    * primary
    * baseline

And intentionally added the hints as I expect it will be after I add this to the local scans:

In [14]: db[-1].metadata['start']['hints']
Out[14]: 
{'scan_type': 'mesh',
 'detectors': ['Ion Ch 4'],
 'monitor': 'Ion Ch 3',
 'gridding': 'rectilinear',
 'dimensions': [[['fourc_x'], 'primary'], [['fourc_y'], 'primary']]}

It turns out the BestEffortCallback has a decent live plot of it:

Screen Shot 2021-03-22 at 5 47 47 PM

strempfer commented 3 years ago

When I read the mesh scan it has 100 points. Shouldn't this be 121 points? Or has a scan 'rel_scan -0.1 0.1 10' in BlueSky only 10 points and 9 intervals? This would be different to spec where an 'ascan th -0.1 0.1 10 1' has 10 intervals and the number of points is 11.

gfabbris commented 3 years ago

Yes, the default in Bluesky is to be the number of points, not interval. But note that both of these are in the metadata:

In [3]: db[-1].metadata['start']['num_points']
Out[3]: 100
In [4]: db[-1].metadata['start']['num_intervals']
Out[4]: 99
codecov-io commented 3 years ago

Codecov Report

Merging #42 (05d5833) into main (d787382) will decrease coverage by 5.80%. The diff coverage is 2.02%.

:exclamation: Current head 05d5833 differs from pull request most recent head 056c9f1. Consider uploading reports for the commit 056c9f1 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##             main      #42      +/-   ##
==========================================
- Coverage   54.62%   48.82%   -5.81%     
==========================================
  Files           7        7              
  Lines         800      891      +91     
==========================================
- Hits          437      435       -2     
- Misses        363      456      +93     
Impacted Files Coverage Δ
polartools/diffraction.py 0.00% <0.00%> (ø)
polartools/db_tools.py 81.17% <100.00%> (-2.36%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d787382...056c9f1. Read the comment docs.