GithubHelp home page GithubHelp logo

ess-dmsc / nexus-constructor Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 29.66 MB

Construct NeXus templates and files with instrument geometry information using a GUI

License: BSD 2-Clause "Simplified" License

Python 20.24% Makefile 0.29% XSLT 0.53% Batchfile 0.09% Shell 0.06% CSS 0.46% HTML 77.33% C 0.16% Java 0.02% MATLAB 0.19% Fortran 0.06% JavaScript 0.55%
pyside2 nexus-files qtforpython ess nexus-constructor gui

nexus-constructor's Introduction

License (2-Clause BSD) codecov Build Status Code style: black

NeXus Constructor

The NeXus Constructor facilitates constructing NeXus files in which to record data from experiments at neutron science facilities. This includes all supporting metadata typically required to perform analysis of such experiments, including instrument geometry information.

The application can directly output a NeXus file, or create a NeXus structure, JSON template of the file to send to the File Writer. The JSON template can include data stream details, such that the File Writer populates the NeXus file it creates with data acquired from the detector and other beamline apparatus during an experiment.

There is a "Getting Started" guide to help new users.

NeXus Constructor

Although the application may be useful to other institutions using NeXus, the NeXus Constructor is being developed as part of the software suite for the European Spallation Source (ESS). Please see this (open access) paper for more information on the ESS software.

The NeXus Constructor should work on MacOS, Linux and Windows; however, none of the current developers use Windows, so occasionally there are issues on Windows - if you find one then please let us know!

Installing dependencies

Binary packages for release versions can be downloaded on the releases page, or to run the latest development version please follow the instructions below.

Python 3.8 or greater is required. https://www.python.org/downloads/

It is HIGHLY recommended that a virtual environment is created for running the nexus-constructor.

Runtime Python dependencies are listed in requirements.txt at the root of the repository. They can be installed from a terminal by running

pip install -r requirements.txt

For MacOS Ventura, it is currently necessary to install libomp manually, e.g. via brew, MacPorts, etc.

Usage

Run the Python script nexus-constructor.py located in the root of the repository.

A guide for getting started with the nexus-constructor can be found here

Developer information

Development dependencies

Development dependencies (including all runtime dependencies) can be installed by using the following command

pip install -r requirements-dev.txt

Install the pre-commit hooks by running the following command

pre-commit install

Now when a commit is made, the hooks will be run automatically.

For more information on pre-commit see the official documentation

Developer Documentation

See the Wiki for developer documentation.

Contributing

The project

The project is managed on the ESS's JIRA system which is here.

If you do not have an ESS account but want to raise an issue then please open an issue on the repository. Someone will triage it and link it from the JIRA system.

Pull requests

Pull requests are very welcome and should be done through GitHub in the standard way.

Code

If you are submitting code then please ensure it passes the pre-commit checks (see above).

nexus-constructor's People

Contributors

aclay avatar amues avatar cow-bot avatar danesss avatar dolicaakelloegwel avatar dominicoram avatar ebadkamil avatar ggoneiess avatar hurvan avatar kmurica avatar mattclarke avatar matthew-d-jones avatar rerpha avatar skytoground avatar umithardal avatar yashikno avatar zjttoefs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

trnielsen

nexus-constructor's Issues

Sketch out full interface design

From this we can identify components to make and prioritise implementation tickets.

Some example ideas for details:

  • What information and controls are needed for each instrument component type?
  • How can relative position + orientation information for each component be entered and displayed?
  • How can "shapeless" components be represented in the 3D view?
  • Display axes and/or grid lines in the 3D view? (https://forum.qt.io/topic/66808/qt3d-draw-grid-axis-lines).
  • Colour match elements in the instrument components list with models in the 3D view?
  • Component type selector, combo box in listview or a modal window when "add component" button is pressed?
  • Do we need icons (for different component types for example?). There are some resources like https://thenounproject.com/ or we may need to make some.
  • Switch between wireframe and solid in 3D view?
  • File writing controls visible in main interface or accessible through MenuBar?
  • Pixel mapping interface (spreadsheet/tableview style interface? label pixels in 3D view?)

Add documentation to README

In the readme briefly explain how to:

  • install dependencies with pip using the requirements file.
  • run the unit tests.

Prepopulate ListView with sample component

sample is the origin of the coordinate system, there must be one, and there can only be one. It therefore makes sense to prepopulate the ListView with this component so that it is always an available option when selecting relative transformations.

Create GUI testing document

Due to problems with, and difficulties using Pyside2, QML, and pytest-qt together, automated GUI tests were removed in 2cf70fb.
To ensure the GUI functions prior to making releases, we will need a document describing manual tests for the interface and their expected outcomes.

Add component type selector dialog

Add component type selector dialog to "add component" button. I suggest "source" (see NXsource documentation) and "detector" options would be good to start with.

Multiple transformations per component

We need to support multiple transformations per component. Therefore, with the except of the sample (which define the origin), transformations should be relative to another transformation rather than to a component.

Perhaps they could be added as child elements to the components in the listview?

Dummy object in 3D view for component with no shape

A "None" option should be available for shape of any component type. Selecting "None" would indicate that a dummy object should be placed in the 3D view at the position of the component, but that there would be no geometry for the component in the output file.

Write to NeXus file

To be non-lossy, for example not loose colour information for models, we may need to add some custom fields.

Single component visualisation in Edit Component Window

Being able to view the current component would be useful for knowing details have been entered correctly, and I feel essential for a useful face number to pixel id mapping interface.
However, due to a bug/bugs in Qt3D, it's not currently possible to have Scene3D instances in child windows.

Examples that seem to match my experiences trying to add a Scene3D to the editor window can be found in the Qt bug tracker at:

Some of these have linked code, one currently due to release with Qt 5.11.3, and Qt 5.12.0, so we should wait for the next release before tackling this issue

Disable face culling in the 3D renderer

When setting up the custom mesh graphics buffers, each triangle is repeated with a reverse winding to ensure it renders regardless of which side is facing the camera.

However, it appears that face culling can be disabled with the right configuration. If this can be achieved, the duplicates in the graphics buffer won't be needed, and the memory they consume will be cut in half.

Avoid javascript business logic

As discussed following #14 we want as close to all of the business logic of the application to be done in python instead of QML javascript so we're not introducing additional languages to the teams projects.

Consider supporting reading shape from STL or STEP format

The Design Division at ISIS uses "Solid Edge" CAD software which does not output to OFF or OBJ without an expensive plugin. It does output to STL or STEP, so if you estimate a day or less to implement support for one of these formats then it will be worthwhile, otherwise we'll manage with converting via an intermediate application for now.

The relevant (shape, not texture etc) information in such files is pretty much the same as in OFF: vertex coords and face definitions using vertex indices. My hope is therefore that it would be low effort to introduce support.

Looks like there is at least one suitable python library for reading STL files: https://pypi.org/project/numpy-stl/

Remove prototype code

The prototype folder hasn't been touched in months, and there's nothing in it that hasn't been also implemented in the main program.
The prototype build has been tagged, so should be easy to find.

I think it's time to remove it's code from master.

Add a pytest test

Just an example test to get us started and give something for our CI system (Jenkins) to run.
The test script can go in a /tests directory.

Load from json description

This is likely to raise other, blocking issues. For example, what if the json description has an NXtransformation which is not in an instrument component?

Leave validation to #472

Windows executable

Having a single file executable or installer early in development would make life easier for potential testers of the application.
pyinstaller and pyupdater are probably the standard tools for this at the moment, worth checking though.

Correct the geometry nexus group names

For NXdetector groups:
detector_shape if NXoff_geometry containing detector_faces, or NXcylindrical_geometry containing detector_number
pixel_shape otherwise

and shape in any other group.

Remove non-standard json description

We can currently output to our NeXus-json description compatible with the file writer, and another json description. The latter of these should be removed. It may be in use because the NeXus-json description is lossy, in which case may need to wait until we have a non-lossy save format (NeXus file?) before removing it.

See "JSON Formats" section of README, and make sure README is updated as part of this ticket.

Update Qt to 5.12

This should give us TableView in Qt Quick Controls 2, which may be useful. Hopefully also solve blocker for #56

Add load from Kafka

Blocked by #53

Get the last "write start" message in the given topic and use the JSON parser implemented for #53 to load geometry information from it.
This would provide a useful tool to visually check geometry information which was sent to the File Writer.

Improve memory usage in repeated mesh detector graphics buffers

Currently, the QtOFFGeometry class repeats the mesh for each instance in a grid.

This means the graphics buffers use much more memory than needed, directly proportional to the number of instances in the grid. Instead, it should just create the mesh for a single instance, and a model should create unique transform matrices for each pixel instance that can be used in the QML.

Add a Jenkinsfile

The Jenkins job should use the CentOS 7 container, run the pytest tests.

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.