Package: nxselector
Welcome to nxselector’s documentation!Authors: Jan KotanskiNeXus Component Selector
is a GUI configuration tool dedicated to select components
as well as datasources which constitute the XML configuration strings of
Nexus Data Writer via Sardana NeXus Recorder.Source code:https://github.com/nexdatas/nxselectorWeb page:https://nexdatas.github.io/nxselectorNexDaTaS Web page:https://nexdatas.github.ioInstallationInstall the dependencies:Sardana, tango, sphinx, Taurus, NXSRecSelectorFrom sourcesDownload the latest version of NeXuS Configuration Server fromhttps://github.com/nexdatas/nxselectorExtract the sources and run$pythonsetup.pyinstallDebian packagesDebianbookworm,bullseye,busteror Ubuntulunar,jammy,focalpackages can be found in the HDRI repository.To install the debian packages, add the PGP repository key$sudosu$wget-q-O-http://repos.pni-hdri.de/debian_repo.pub.gpg|apt-keyadd-and then download the corresponding source list, e.g.$cd/etc/apt/sources.list.d$wgethttp://repos.pni-hdri.de/bookworm-pni-hdri.listFinally,$apt-getupdate$apt-getinstallpython3-nxsrecselectornxselectornxsrecselectorTo instal other NexDaTaS packages$apt-getinstallpython3-nxswriternxsconfigtoolnxstoolspython3-nxsconfigservernxsconfigserver-dband$apt-getinstallpython3-sardana-nxsrecordernxstaurusguifor NeXus recorder and MacroGUI packages.From pipTo install it from pip you need also to install pyqt5, e.g.$python3-mvenvmyvenv$.myvenv/bin/activate$pipinstallpyqt5$pipinstallnxselectorMoreover it is also good to install$pipinstallpytango$pipinstallsardana$pipinstallnxswriter$pipinstallnxsrecselector$pipinstallnxsconfigserver$pipinstallnxstools$pipinstallpymysqldbSetting environmentSetting SaradnaIf sardana is not yet set up run$Poolenter a new instance namecreate the new instanceThen wait a while until Pool is started and in a new terminal run$MacroServerenter a new instance namecreate the new instanceconnect poolNext, run Astor and change start-up levels: for Pool to 2,
for MacroServer to 3 and restart servers.Alternatively, terminate Pool and MacroServer in the terminals and run$nxsetupstartPool-l2wait until Pool is started and run$nxsetupstartMacroServer-l3Additionally, one can create dummy devices by runningsar_demoin$spockSetting NeXus ServersTo set up  NeXus Servers run$nxsetupsetor$nxsetupsetNXSDataWriter$nxsetupsetNXSConfigServer$nxsetupsetNXSRecSelectorfor specific servers.If theRecoderPathproperty of MacroServer is not set one can do it by$nxsetupadd-recoder-path/usr/lib/python2.7/dist-packages/sardananxsrecorderwhere the path should point thesardananxsrecorderpackage.General overviewDevice SelectionEvery measurement requires devices to be selected. The Component Selector (CS) is a graphical user interface serving this purpose. It is launched from a Linux terminal by$nxselectoror from Spock byp09/door/haspp09.01 [1]: nxselectorFigure 1.1: Component Selector: DetectorsConfiguration of the each hardware device for the NeXus files is described inside a configution string, i.e. a configuration component. The employed configuration concept is inspired by the following hardware/configuration correspondences:
.. For more details about NeXus configuration components and their data sources see Section 10.7measurement<=>fileexperimental setup<=>NeXus configurationhardware device<=>componentdevice attribute, e.g. counter reading, motor position <=>data sourceTheFigure 1.1displays the Detectors tab of the Component Selector including the available device components. Composite components are the one with multiple data sources. Simple components are distributed in the frames labelled Counters, ADC, MCA, etc. Components are selected by activating theSel.checkbox. If theDis.checkbox is enabled, the output of the device is displayed during the scan for monitoring purposes.Simple components may be part of composite components. As a consequence, selecting a composite component may implicitly select one or more simple components. This dependency has to be visible for the users. Therefore, simple components being implicitly selected are deactivated and their font colour changes to grey. The user may also move the mouse over a composite component to inspect the contents.Ideally all devices are contained in components ensuring that they have sensible NeXus paths and meaningful metadata associated with them. In practice this is not always possible. Consider a counter module with 32 channels. Some of them are permanently connected to specific detectors. It is an easy task to create components for these inputs. However, during the course of a beamtime, it may happen that a researcher needs to record some other signal. Depending on the circumstances it may be impossible to create a new component immediately. Still the new signal has to be recorded. In order to handle this situation, dynamical components have been introduced. They are automatically created whenever a selected device is not covered by a component.In the upper part of the Selector window the user sets Scan File, Scan Directory and if consecutive scans are appended to one file or stored separately. To use NeXus Sardana Recorder the file extension has to be set to.nxs,.nx,.h5,.ndf.Before the scan all the changes has to be confirmed by the Apply button. Its action updates settings of the active Sardana measurement group and configuration of the Component Selector.The Others button of Detectors allows for the user to add simple devices into the measurement group. Its attribute values will be stored for each the scan point.After devices have been selected and applied the state of all tabs is stored into a profile in the NeXuS Configuration Server. Theprofilecontains setting informations, i.e. selected components, user data and file settings, required to prepare configuration for the NeXus writer. The profile extends its measurement group so they share the same name. It is possible to create several profiles. A required profile can be loaded to restore a particular device selection. It is done automatically by changingMntGrpin the Selector.Moreover, by pressing theSaveorLoadbuttons, the user can save to a file or load the current scan profile. This way, the researcher can easily switch from one data acquisition setup to another.Figure 1.2: Component Selector: DescriptionsThe Descriptions tab,Figure 1.2, displays components containing metadata which are stored only before or after the scan. They are divided into two groups: theMandatorybeamline-specific components and theOptionaldiscipline-specific components. TheMandatorybeamline group describes the source device and the facility. TheOptionaldiscipline group contains information about the spatial arrangement of the experimental setup, mainly motor positions. The user can select or deselect the optional components from the current profile.Moreover, theReset Desc.button of Descriptions sets a group of descriptive components to the default one, i.e. defined in the DefaultAutomaticComponents property of the current NXSRecSelector server.TheOthersbutton of Descriptions allows for the user to add simple devices into the profile descriptions, i.e.Other Optional. Its attribute values will be stored before the scan point.During appling the selected profile informations from Descriptive components are also stored in thePreScanSnapshotdoor environment variable.
This helps to store the metadata informations by other Sardana recorders.Figure 1.3: Component Selector: NeXus User DataIn order to describe the experiment completely some of the client data have to be provided by the user. TheFigure 1.3shows the CS tab allowing the researcher to supply this information. Typical examples for user-supplied metadata are title, sample name and user comment.The layout of the Component Selector can be easily adapted into different beamline specification in the Configuration tab.IconsIcons fetched fromhttp://findicons.com/pack/990/vistaico_toolbar.