Coder Social home page Coder Social logo

ezconcert's People

Contributors

ldorofeeva avatar maxthemouse avatar sgasilov avatar

ezconcert's Issues

Check camera mode

Need to check the camera trigger mode before setting. The driver will error if the mode is set to the same mode that it is already in. This might be a good idea to check in general.

QTimer error during motion

User reported that error occurs when motion is started while stage is still moving. Message to wait occurs as expected but there can be exception due to Qtimer.
Should do one of:

  1. Add check for motion before trying to move
  2. Grey out buttons during motion

Make a GUI like LabVIEW interface

There is a LabVIEW program called Operator Interface. It provides simple function like enable|disable|home|FaultAck etc. It provides a simple interface for motion and constant velocity motion. These are useful for specific experiments outside of CT measurements.

operator_interface

Add license

Should have an appropriate license and copyright file.

I have gotten permission to use BSD 3-Clause License rather than a CLS specific license.

Need fault indicator(s) and a way to clear faults.

Need to display some kind of fault information in the gui. Need to be able to clear the faults. Perhaps this can be automatic.

One situation where this will happen is when the user is attaching a sample and they put more torque on the stage than the brake can handle. The stage will move and go into an error condition. The over-current fault needs to be cleared before the stage can be used again.

Add shutter control and indicator

Make additions to the gui.

  • add connection to a shutter
  • add a button to open/close the shutter
  • add indicator of the motor state

Ideas for control

  • use a toggle button
  • red text indicated that the shutter is not available, i.e. disabled
  • green open text
  • blue close text

Indicator

  • simple shape like a circle or square led
  • red = closed
  • green = open

Return button function

The return button does not seem to do anything. Is it connected? What is the expected function? Should it read values from somewhere?

Improve logging

Make improvements to the logging system.

  • use command line to turn on output to console
  • use log module to improve setting formats etc (like in devioc)

No perfect overlap between the 0 and 180 projections in AUTO scan

No perfect overlap between the 0 and 180 projections in AUTO scan - like a pixel or half off.
Seems like the images at 0 and 180 degrees are not exact. This might be timing. This might be in how the velocity is calculated. This might not assume that the last point should be exactly 180 degrees from the start.

Remove print statements

Print statements are used for debugging. This might interfere with Qt or be less stable.

Example.
Use a Message Handler.

import sys
from PyQt5 import QtCore, QtWidgets

def qt_message_handler(mode, context, message):
if mode == QtCore.QtInfoMsg:
mode = 'INFO'
elif mode == QtCore.QtWarningMsg:
mode = 'WARNING'
elif mode == QtCore.QtCriticalMsg:
mode = 'CRITICAL'
elif mode == QtCore.QtFatalMsg:
mode = 'FATAL'
else:
mode = 'DEBUG'
print('qt_message_handler: line: %d, func: %s(), file: %s' % (
context.line, context.function, context.file))
print(' %s: %s\n' % (mode, message))

QtCore.qInstallMessageHandler(qt_message_handler)

app = QtWidgets.QApplication(sys.argv)

def main():
QtCore.qDebug('something informative')
win = QtWidgets.QMainWindow()
# trigger a Qt debug message
win.setLayout(QtWidgets.QVBoxLayout())

main()

Request: save N images (Stream to disk)

User request to save a specific number of images when doing stream to disk. The request was for 10 images or some other number.
This would require an input to the GUI.
The current behavior is to stream to disk as fast as possible until the button to stop is pressed. A counter might be possible as well.

Change to motor controls

  • Request to change the buttons for relative motion to have separate buttons for positive and negative motion. This is avoid having to type the sign in the field or to click on a sign button.
  • The stages are a little confusing., In particular, the vertical and horizontal motions are next to each other. The label is only on a button and is too small and not prominent. Add a label or something to make it clear.

Consistent handling of start scan

Want to have a consistent handling of the start position for scans.

  1. Currently some scans start by recording the current position. Want to remove this.
  2. Use the first point of the scan parameters i.e. start. If the distance to the position is long (> 360) give a warning and ask if the user wants to use home to get to the start.
  3. Move the stage to the first position before scanning; start position
  4. Do scan.
  5. Return the stage to the start position.

Note. Want to avoid large motions that will take a long time. Wrapping the stage around could be a problem for cables, etc.

Check camera mode before setting

Need to check the camera trigger mode before setting. The driver will error if the mode is set to the same mode that it is already in. This might be a good idea to check in general.

Acquire image sequence in Auto mode

New scan mode requested.

  • Start recording/stop recording with live preview; Save sequence;
  • Live images while running

This is the mode in Camware. You start recording and can stop at anytime. This is quite common with camera programs and goes by various names. This is a sequence acquisition but with interactive control.

The requested mode is with Auto trigger mode which is the fast mode for the Dimax camera.

move edc to ezconcert

The EDC (Epics Devices for Concert) is currently a sub module in a larger project, soft-ioc. It would be useful to move the concert specific part to ezconcert.

  1. EDC is in python 2.7 as is ezconcert. Whereas soft-ioc is python 3.x. It would be easier to avoid version conflicts.
  2. Put all the concert components together.
  3. EDC has epics related functions that can be used by ezconcert.
  4. Makes it easier to find motor function rather than being buried in a larger project.

Problems with TTL scan

Scan doesn't run. There is a problem with setting the camera. A dummy camera is used but it doesn't have the correct attributes. Probably need to avoid the camera as it is not needed. The required settings are passed already.

Add more velocity control to GUI

Feature request

  1. setting CT stage speed precisely by hand (maybe in addition to 5-20 switch) to be able to do scans "by hand" sometime
  • add an entry for setting velocity
  • probably remove switch to avoid clutter
  • want to set the velocity and then start the motion
  • add a start button or jog button(s)
  • look at other apps for style, button placement and labelling to be consistent with other beamline applications

Extra images in TTL scan

There sometimes extra triggers sent or camera takes an additional image.

User report:

Set-up:
PCOEdge 5-5 with 2x
20ms exposure ->cameware
20ms exposure -> GUI
5ms delay -> GUI
Mode -> Half-acquisition

So in halfaq mode there is a unique combination of values which lead to an additional projection being grabbed.

I initially start with 2000 projections , 20 flats, 20 darks -> no issues
Tried 3000 projections, 20 flats, 20 darks -> no issues
Tried 4000 projectinos, 20 flats, 20 darks -> 4001 projections are grabbed in cameware so you miss 1 * x images on your final projection. i.e. If you want 4 views you should allocate 16160 projections, however on view 4, 4 projections are lost.

Temporary work around ๏ƒ  set allocation to 4041 * views in allocation dialogue. This is annoying though as you must delete this extra view for the half-aq stitching to work as it needs an even about of images to stitch..

Extra images is not a serious issue as it is at most an inconvenience to delete them.
The likely issue is the extra distance padding added to insure that there are no images lost can add an image. Need to look at details of how the distance is calculated and set. This could be a numeric round-off issue.

Make a script for doing ttl pulses

It would be useful to have a utility for doing ttl pulses.

  • A small python script like abort.py and home.py
  • a gui like the LabVIEW program Generate-TTL

Relative motor motions

Motor control - would be good to have relative move entry.

Currently, there is only absolute motion control. Add a relative motion. Should look at CLS programs and follow that design. Eg have three fields in a row:

  1. +/- button that selects the direction
  2. entry field for value
  3. Go button

This will likely require a redesign of that space to be clear. Change the absolute motion to follow the same pattern

  1. entry field for value
  2. Go button

Will need a bit of design work to avoid too much clutter or confusing labels and buttons in a small area.

When should auto/auto scan stop the motion?

The draft manual claims that the stage will stop before the data is read from the camers. Currently, the data is read first and then the stage is stopped. Should it be changed? Currently, it has only been tested in the current mode.

Settings for CT stage

There are a few settings to think about for the rotation stage. It is also desirable to not clutter the gui too much. One possibility is to add a button to open a configuration window to set values.

  • Two speeds: slow (5 deg/s) and fast (20 deg/s)

Request: Don't return vertical stage at end

User request to not return the vertical scan at the end of the scan. This was for a case where multiple steps were used but not all at once. The reason was so that the sample could be adjusted between steps. The vertical stage is very slow and returning to the start required moving back each time.
This would add a selection to the GUI.

Stop all does not stop CT stage

If the stage is in freerun mode and is moving it is not possible to stop the stage using Stop All or Home. Either of these functions should work.

Motor position and motion

Want to add to the gui.

  • Indicate the position of the motor
  • allow for moving to a new position
  • use absolute positions for all functions; could think about adding relative motions in the future
  • add a move button
  • add set buttons to allow for easy setting positions for specific points such as the position for flats and the position for scanning

Dimax "exp time" does not automatically change fps

Noted that the exposure time for the Dimax camera did not behave as expected.

  1. FPS and exposure time are are independent and need to be set independently. Note that if fps is lower then certain value (I guess 25 fps -> 40 msec exp) libuca will crush without the error
    7:46
  2. It should be possible to grab frames while DImax is recording if camera.storage_mode is set to recorder. You get the last frame. Tomas noted that the SEQUENCE mode is more exact in ultrafast imaging because grab will get frame chronologically.
    7:46

Apparently at very fast fps frame are not necessarily stored in the memory chronologically

Create utility program

Combine various utility scripts into one program. Could be a gui or a command-line program. It has be be easy for people to use.

Scan will freeze if camera is busy.

Although there are some checks the scan will freeze if the Live On function is still running. Probably need to run the Live Off function before a scan runs or show a message.

Simple sequence scan

Typical software like Camware and HCImage can take a sequence of images and save it. This mode is to simple click start and have the camera take a sequence of the specified number of images. Saving can be optional if the sequence is stored in RAM first.

Configuration file

Currently, motors and the like are hard-coded. It would be better to have a configuration file to define a specific set of motors, shutters, PVs.

A specific design has not been decided on. The file might be read into an object or a dictionary.

Logging is redundant

It looks like a lot of the logging is appearing in two log files; ezconcert.log and edc.log.

  1. It might be as simple as removing the separate ezconcert.log file name when creating the log. Everything would go into edc.log.
  2. It might be possible to rename the log; ezoncert.log --> edc.log
  3. Leave as is.

Remove print statements

Print statements are used for debugging. This might interfere with Qt or be less stable.

Example.
Use a Message Handler.

import sys
from PyQt5 import QtCore, QtWidgets

def qt_message_handler(mode, context, message):
if mode == QtCore.QtInfoMsg:
mode = 'INFO'
elif mode == QtCore.QtWarningMsg:
mode = 'WARNING'
elif mode == QtCore.QtCriticalMsg:
mode = 'CRITICAL'
elif mode == QtCore.QtFatalMsg:
mode = 'FATAL'
else:
mode = 'DEBUG'
print('qt_message_handler: line: %d, func: %s(), file: %s' % (
context.line, context.function, context.file))
print(' %s: %s\n' % (mode, message))

QtCore.qInstallMessageHandler(qt_message_handler)

app = QtWidgets.QApplication(sys.argv)

def main():
QtCore.qDebug('something informative')
win = QtWidgets.QMainWindow()
# trigger a Qt debug message
win.setLayout(QtWidgets.QVBoxLayout())

main()

exception from shutter

Closing or opening the shutter can throw an exception when the state is already closed or opened. need to catch the TransitionNotAllowed error.

Check motor state

Trying to move the motor can throw an exception. The error is that the state is 'moving' and not in a state that it can use.

  • This might need to be in EDC but I am certain.
  • In any case, the program should not be killed due to this error.

Add jog motion control

Request:

  • remove velocity slider
  • put in a control for entering velocity
  • add buttons to start motion at the input velocity i.e. jog
  • once started the motion continues until the velocity is set to 0 or stop button is pressed
  • optionally add a stop button just for CT motion to stop the jog

add switch to dummy motors

The hardware is not always available due to it being in use. Need to be able to switch to dummy devices for testing.

  • It would convenient to have a switch or argument to add this.
  • In the future when there is a configuration file it would be possible to simple have a testing configuration that defines dummy hardware.
  • This should include the epics monitors somehow but this will require some research to see how this might be done.

Include/don't include the end point

The current behavior is to ignore the checkbox for including the end point. This might only be needed for the step and shoot scan. This should be checked for the step and shoot and for PSO-based triggered scans.

Improve use of join

There are places in the code that use function(), join() and result() in inconsistent ways. These are various ways of using futures to return right away or wait until done. Note that the function have to synchronous functions for the future to work.

  • functions should use join() to wait until done.
  • result can be removed as this was an add on and is not part of python futures

Recovery of stage from Faults and Errors

The stage was left in a moving stage after a PSO scan or perhaps due to an aborted scan. The question arose on how to stop the stage. The stop all button should have done this. Check this function more and look at adding a separate abort/reset program for dealing with such issues. It could include a display of faults and conditions. Would be useful for diagnosis and monitoring the status of the stage.

Problem with 2 image scan

User reported that a scan with 2 images does not stop after the images are taken. The trigger mode is with software. For example the points are at 0 and 180.

Experiment timer is flagged by linter

In gui.py two timers are initialized;

self.total_experiment_time = QTimer()
self.last_inner_loop_scan_time = QTimer()

However, in the code there are things like: self.total_experiment_time = time.time()
Seems like start, stop methods should be used on the QTimer instead to measure the time.

Move error in PSO_scan

Error occurs after the scan. Exception is: float object has no attribute 'to'.
This probably an error with using a float instead of a quantity.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.