From b320198be4309b29f31795595f6f770a70564fb1 Mon Sep 17 00:00:00 2001 From: Maciej Bartkowiak Date: Tue, 26 Mar 2024 15:18:07 +0000 Subject: [PATCH 01/11] Clean up several initial pages of the documentation --- Doc/conf.py | 6 +- Doc/pages/T_start.rst | 17 +- Doc/pages/files.rst | 37 +- Doc/pages/gui .rst | 683 ------------------------------------- Doc/pages/gui.rst | 39 +-- Doc/pages/installation.rst | 12 +- Doc/pages/introduction.rst | 33 +- Doc/pages/opening.rst | 4 +- 8 files changed, 37 insertions(+), 794 deletions(-) delete mode 100644 Doc/pages/gui .rst diff --git a/Doc/conf.py b/Doc/conf.py index 4647ec61fe..d7595d4710 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -41,8 +41,8 @@ # project = 'MDANSE' # copyright = '2015-2022, Eric Pellegrini' author = 'Eric Pellegrini' -release = '1.5.2' -version = '1.5' +release = '2.0.0a1' +version = '2.0' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -86,7 +86,7 @@ current_year = datetime.date.today().year # General information about the project. project = u'MDANSE' -copyright = u'2015-' + str(current_year) + u', MDANSE is developed and supported by the Institut Laue-Langevin and the ISIS Neutron and Muon Source', '![UKRI Logo](_static/UKRI_Logo.png)' +copyright = u'2015-' + str(current_year) + u', MDANSE is developed and supported by the Institut Laue-Langevin and the ISIS Neutron and Muon Source, ![UKRI Logo](_static/UKRI_Logo.png)' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/Doc/pages/T_start.rst b/Doc/pages/T_start.rst index 89c11938db..68a88c8d5d 100644 --- a/Doc/pages/T_start.rst +++ b/Doc/pages/T_start.rst @@ -1,6 +1,8 @@ Tutorial: Get started (Installation) ==================================== +.. _installation_tutorial: + MDANSE Installation Steps -------------------------- @@ -42,7 +44,7 @@ activation command varies by operating system: - On Windows: - .. code-block:: bash + .. code-block:: console mdanse\Scripts\activate @@ -53,7 +55,7 @@ Use `pip` to install the MDANSE package from the specified GitHub repository: .. code-block:: bash - python -m pip install "git+https://github.com/ISISNeutronMuon/MDANSE@protos#egg=MDANSE&subdirectory=MDANSE" + pip install MDANSE Install MDANSE_GUI Package ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -62,16 +64,7 @@ Similarly, install the MDANSE_GUI package using `pip`: .. code-block:: bash - python -m pip install "git+https://github.com/ISISNeutronMuon/MDANSE@protos#egg=MDANSE_GUI&subdirectory=MDANSE_GUI" - -Install PyQt6 -~~~~~~~~~~~~~ - -MDANSE relies on PyQt6, a Python binding for the Qt library. Install it using `pip`: - -.. code-block:: bash - - pip install PyQt6 + pip install MDANSE_GUI Run MDANSE ~~~~~~~~~~ diff --git a/Doc/pages/files.rst b/Doc/pages/files.rst index d833adbcef..49b6d8df0d 100644 --- a/Doc/pages/files.rst +++ b/Doc/pages/files.rst @@ -34,9 +34,10 @@ HDF5 format using the Trajectory Converter tool. DAT File Format ----------------- -During an Analysis in MDANSE, the default output format is now `DAT files `_, which +An alternative output format of Analysis results is in the form of +`DAT files `_, which are text-based and easily readable. Each DAT file corresponds to a specific -variable generated during the analysis. If the ASCII option is selected, a +variable generated during the analysis. If the Text option is selected, a tarball is generated, which contains multiple files, including: - ``jobinfo.txt``: A text file documenting the analysis options selected during @@ -68,35 +69,3 @@ repetitive tasks and ensuring consistency in analysis procedures. This update streamlines the analysis process and facilitates the reproducibility of results within MDANSE. -.. _convert_netcdf: - -NetCDF to HDF5 Conversion Script ---------------------------------------- - -MDANSE now provides a versatile Python script that simplifies the process -of converting existing NetCDF files to the HDF5 format. This script is especially -valuable for users with legacy data stored in NetCDF files who wish to take -advantage of the enhanced capabilities and compatibility offered by MDANSE's -shift to HDF5. - -To perform the conversion, follow these steps: - -1. Open a terminal or command prompt. -2. Navigate to the directory containing the NetCDF files you want to convert. -3. Run the following command, replacing [input_file.nc] with the name of your - NetCDF file and [output_file.h5] with your desired name for the resulting - HDF5 file:: - - .. code-block:: bash - - python convert_netcdf_to_hdf5.py [input_file.nc] [output_file.h5] - - This command will execute the conversion script and generate an HDF5 file - with the specified name. - -4. Once the conversion is complete, you can use the newly created HDF5 file - seamlessly within MDANSE for advanced analysis and visualization. - -This convenient script streamlines the migration of existing data to the HDF5 -format, ensuring that users can leverage MDANSE's enhanced features while -preserving their valuable data. diff --git a/Doc/pages/gui .rst b/Doc/pages/gui .rst deleted file mode 100644 index 35cd4e663d..0000000000 --- a/Doc/pages/gui .rst +++ /dev/null @@ -1,683 +0,0 @@ - -Navigating the MDANSE GUI -===================================== - -The MDANSE Graphical User Interface (GUI) is the central hub for -performing various actions, including opening trajectories, configuring -analysis parameters, and visualizing results. This section provides an -overview of how to effectively utilize the MDANSE GUI. - -Key Actions in the MDANSE GUI ------------------------------------ - -Through the MDANSE GUI, you can perform a range of essential tasks: - -- Opening Trajectories: Begin by opening a trajectory, which serves as - the foundation for your analyses. -- Configuring Analysis: Specify the parameters for the analysis you wish - to perform, tailoring it to your research needs. -- Initiating Calculations: Start the calculation process to obtain - insightful results. -- Plotting Analysis Results: Visualize and interpret the outcomes of your - analysis through plots and graphs. -- File Conversions: Perform file conversions, enabling compatibility with - different formats. -- Geometrical Structure Visualization: Explore the geometrical structure - of your calculations for deeper insights. -- Creating Input Files and Scripts: Generate input files for the - command-line interface or auto-start analysis Python scripts directly - from the GUI. - -Operating the MDANSE GUI -------------------------------- - -The MDANSE GUI offers user-friendly interaction methods, including the -following: - -- Double-Click: You can double-click various objects within the GUI to - trigger actions. -- Drag & Drop: - Simply drag your trajectory into the main GUI window, and a tab will - be created. Drop an analysis operation into the tab to perform the - analysis on the trajectory. Drop the Molecular Viewer into the tab to - visualize the trajectory. - -Starting the MDANSE GUI -------------------------------- - -The new MDANSE GUI is a separate Python package that can be installed -using pip. This interface is built on the QtPy interface, which -leverages your existing Python bindings to interact with the Qt -libraries. For optimal functionality, ensure you have one of the -following installed: PyQt5, PyQt6, or PySide 2. The interface is -designed to be compatible with these libraries, providing a seamless -user experience. - -The MDANSE GUI can be initiated on different platforms as follows: - -Windows ---------------- - -- If you selected the option to create a desktop shortcut during - installation, you can use that shortcut to start MDANSE. -- Alternatively, navigate to the folder where MDANSE is installed - (default path: C:\Program Files\MDANSE). There, you can double-click - the file named "MDANSE" with the MDANSE icon. -- To start MDANSE from the command line, execute the batch file - "MDANSE_launcher.bat." Ensure you use quotation marks if the path - contains spaces. - -7.3.2. MacOS -------------- - -- If you installed MDANSE normally, you can find the MDANSE icon in the - Applications folder and start it like any other app. Note that you may - need to adjust your system settings due to Apple's security measures - (see Ref [Ref4] for a guide). -- To start MDANSE GUI from the terminal, use the following command - (replace /Applications if you installed MDANSE elsewhere): - - .. code-block:: bash - - /Applications/MDANSE.app/Contents/MacOS/MDANSE - -7.3.3. Linux -------------- - -- If your Linux distribution has an applications menu, you should find - an MDANSE icon there for launching the GUI. -- If not, you can start MDANSE from the terminal using the following - command: - - .. code-block:: bash - - mdanse_gui - - If this command doesn't work, locate the MDANSE installation directory. - By default, it should be in /usr/local. Search for the mdanse_gui script - within /usr/local/bin. Once found, run the following command: - - .. code-block:: bash - - /usr/local/bin/mdanse_gui - -The MDANSE GUI serves as a versatile platform for performing a wide range -of analyses and visualizations in a user-friendly manner, enhancing your -research capabilities. - -The standalone GUI elements ---------------------------- - -Some parts of the GUI can also be started on their own. These are: - -mdanse_elements_database -~~~~~~~~~~~~~~~~~~~~~~~~ - -This script has no options. When run, it opens the `Elements Database -Editor <#_Elements_database_editor>`__ GUI window. - -mdanse_gui -~~~~~~~~~~ - -This script has no options. When run, it opens the main `MDANSE -GUI <#_The_main_window>`__ window. - -mdanse_job -~~~~~~~~~~ - -This script is used to run a `job <#_Analysis>`__. It opens the GUI -window for the selected job without opening the main window. To do this, -two positional arguments are required (meaning only the values should be -placed after mdanse_job, no -- options like for the mdanse script). -These two arguments are as follows: - -- **job** – the short name of the job to be run (e.g., pdf for Pair - Distribution Function). -- **trajectory** – (only required for analyses; should be left blank - for trajectory converters) the path to an MMTK trajectory file used - for the job. - -mdanse_periodic_table -~~~~~~~~~~~~~~~~~~~~~ - -This script has no options. When run, it opens the `Periodic -Table <#_Periodic_table_viewer>`__ GUI window. - -mdanse_plotter -~~~~~~~~~~~~~~ - -This script has no options. When run, it opens the :ref:`2d3dplotter` -GUI window. - -mdanse_ud_editor -~~~~~~~~~~~~~~~~ - -This script has no options. When run, it opens the `User Definitions -Editor <#_User_definition>`__ GUI window. - -mdanse_units_editor -~~~~~~~~~~~~~~~~~~~ - -This script has no options. When run, it opens the Units Editor GUI -window. - - -The main window ---------------- - -Below is an image of the window you will see when you open MDANSE GUI. -All the parts have been marked and their short descriptions can be found -below. Further information on all parts is in the following sections. - -Please note that all pictures come from Windows 10, so the GUI will look -very slightly different on other platforms. However, MDANSE works -equally well, bugs notwithstanding, on all platforms. - -.. image:: ./Pictures/100000000000035A00000225D9D9B30259888397.jpg - :width: 15.921cm - :height: 10.186cm - -1. `File menu <#_The_File_menu>`__ handles file manipulation. It can be - used to load NetCDF trajectories or to convert other trajectories - into the NetCDF format. -2. `View menu <#_The_View_menu>`__ allows you to hide/show various - parts of MDANSE. -3. `Help menu <#_The_Help_menu>`__ contains access to files that you - can use to better understand MDANSE and the theory behind it. -4. `Load trajectory button <#_Load_data>`__ can be used to load a - NetCDF trajectory. -5. `Periodic table viewer <#_Periodic_table_viewer>`__ opens a periodic - table containing the constants and data that MDANSE uses for - calculations. -6. `Elements database editor <#_Elements_database_editor>`__ allows you - to change the atomic constants that MDANSE uses for calculations. -7. :ref:`2d3dplotter` launches a window where the - calculated data can be plotted, and the plots formatted. -8. **User definitions editor** opens a window where you can view the - definitions that have been created for each trajectory. More on - definitions in `Selections <#_Creating_selections>`__. -9. `Units editor <#_Unites_Editor>`__ opens a window where the units - used in MDANSE can be managed. -10. **MDANSE classes framework** allows you to peruse the documentation - for the classes that make up MDANSE. This is useful if you want to - use MDANSE from the command line. -11. **Save analysis template** allows you to create a new analysis. This - will be available in My jobs inside the Plugins panel and can be run - like the native analyses. -12. **Open MDANSE API** opens MDANSE documentation in a browser. This is - very similar to MDANSE classes framework. -13. **Open MDANSE website** opens the MDANSE - website [Ref8]_ in a browser. -14. **About** launches a window with very basic information about the - MDANSE you have installed. -15. **Bug report** opens your default mail application. Please use this - or create an issue on MDANSE - GitHub [Ref9]_ to inform us of any issues - you have come across. -16. `Quit MDANSE <#_Quit>`__ closes the MDANSE window. -17. `Data panel <#_Data_panel>`__ contains any NetCDF files you loaded - into MDANSE using either #4 Load trajectory button, or from #1 File - menu > Load trajectory. -18. `Plugins panel <#_Plugins_panel>`__ contains all the options you can - do with the selected trajectory. -19. `Working panel <#_Working_panel>`__ shows the trajectories you have - opened. To open a trajectory, double click a trajectory in #16 Data - panel. You can then inspect the system described by the trajectory. -20. **Logger** shows all the messages generated by MDANSE. These can be - errors or information messages, such as ones confirming you saved a - script etc. -21. **Console** is a Python shell. It can be used like normal when - python is being used from the command line, i.e.. when python is - typed and executed in an OS shell. It contains all the bundled - modules, but you will need to import them first. -22. `Jobs <#_Jobs>`__ shows the status of all current jobs. Once you - start an analysis or trajectory conversion, you can view its - progress here - -Load data -~~~~~~~~~ -This option allows you to select an HDF file. Clicking the Load Data -button opens a standard (platform-specific) file browser, similar to the -one shown below: - -[Image: File Browser] - -Use it as you normally would, and the selected file will appear in the -Data Panel. While the file browser suggests that you can load the MVI trace -file format, please note that this feature is not currently implemented. -Therefore, only load HDF files. If you have a trajectory from another source, -it must first be converted.For more details on converting trajectories, -please refer to the next section. - - -Trajectory Converter ---------------------------- - -This option enables the conversion of a trajectory to the HDF trajectory format. -Hovering over the Trajectory Converter -reveals the following menu: - -- **Help** will open MDANSE documentation for the converter class. -- **Save** creates a python script with the values of all the fields - set the way they were when the button is clicked. This script can be - used to quickly run this conversion again in the future. -- **Run** initiates the conversion. Its progress can be seen in - `Jobs <#_Jobs>`__. After a successful Run, the converted trajectory - is saved in the location specified in the field “output files” in the - converter interface. - -The descriptions of all converters will be found in `Appendix -1 <#_Appendix_1>`__. - -Quit ------ - -Selecting this option opens a confirmation prompt. If you select "Yes," MDANSE -will close. - -The View Menu -------------------- - -This menu offers several options to show/hide various parts of MDANSE: - -- Toggle Data Tree: Shows/hides the Data Panel. -- Toggle Plugins Tree: Shows/hides the Plugins Panel. -- Toggle Controller: Shows/hides the bottom bar containing Logger, Console, and Jobs. -- Toggle Toolbar: Shows/hides the toolbar. - -The Help Menu -------------------- - -Clicking the Help button reveals the following menu: - -- **About** opens a window containing information about MDANSE version, - a short summary, and a list of authors. -- **Simple help** opens a window with a brief summary of MDANSE - workflow and the various options that can be encountered. -- **Theoretical background** opens, in a browser, a document - summarising the theory behind many of the analyses. -- **User guide** opens the DOI to this user guide in the default - browser, showing a RAL Technical Report webpage. From there, this - user guide can be downloaded as a pdf. -- **Bug report** opens the default email app so that you can send us an - email, informing us of any issue you have encountered. When reporting - an issue, please include a picture or copy of the error, such as the - `traceback from job failure <#STATE>`__. - -Toolbar ------------- - -The Toolbar is a set of pictographic buttons that enable you to quickly -perform essential actions. Below is a brief overview of each button, from left -to right: - -1. **Load trajectory button** can be used to load a NetCDF trajectory. - More information in `Load data <#_Load_data>`__. -2. `Periodic table viewer <#_Periodic_table_viewer>`__ opens a periodic - table containing the constants and data that MDANSE uses for - calculations. -3. `Elements database editor <#_Elements_database_editor>`__ allows you - to change the atomic constants that MDANSE uses for calculations. -4. :ref:`2d3dplotter` launches a window where the - calculated data can be plotted, and the plots formatted. -5. **User definitions editor** opens a window where you can view the - definitions that have been created for each trajectory. More on - definitions in `Selections <#_Creating_selections>`__. -6. `Units editor <#_Unites_Editor>`__ opens a window where the units - used in MDANSE can be managed. -7. **MDANSE classes framework** allows you to peruse the documentation - for the classes that make up MDANSE. This is useful if you want to - use MDANSE from the command line. -8. **Save analysis template** allows you to create a new analysis. This - will be available in My jobs inside the Plugins panel and can be run - like the native analyses. -9. **Open MDANSE API** opens MDANSE documentation in a browser. This is - very similar to MDANSE classes framework. -10. **Open MDANSE website** opens the MDANSE website in a browser. -11. **About** launches a window with very basic information about the - MDANSE you have installed. -12. **Bug report** opens your default mail application. Please use this - or our GitHub [Ref9]_ to inform us of any - issues you have come across. When reporting an issue, please include - a picture or copy of the error, such as the `traceback from job - failure <#STATE>`__. -13. **Quit MDANSE** closes MDANSE. - - -Periodic table viewer -~~~~~~~~~~~~~~~~~~~~~ - -Once launched, it will open this window: - -.. image:: ./Pictures/100000010000031E000001EB8316D84CE16D60A9.png - :width: 15.806cm - :height: 9.733cm - -By hovering over an element, detailed information from MDANSE elements -database will show up at the top. By clicking on an element, a list of -its isotopes will appear as a menu: - -.. image:: ./Pictures/100000010000007B00000072BD990BE2296AF016.png - :width: 3.254cm - :height: 3.016cm - -When an isotope is selected, all the information that is stored in the -database will be displayed: - -.. image:: ./Pictures/100000010000024600000333543D0D0EC0A01C7E.png - :width: 7.509cm - :height: 10.566cm - -Clicking on the link at the bottom opens a Wikipedia article about that -element. Other than that, you cannot interact with this page in any way. -If you would like to change any of the displayed data, you will have to -use the Elements database editor. - -Elements database editor -~~~~~~~~~~~~~~~~~~~~~~~~ - -Clicking on this button opens this window: - -.. image:: ./Pictures/10000001000003160000018C76F0FE861E14A12B.png - :width: 15.789cm - :height: 7.895cm - -It can be interacted with like a normal spreadsheet; click (or double -click) on a field you want to edit and type the new value. Once you are -done with making changes, don't forget to save them before closing. You -can do that through the file menu. - -File menu -^^^^^^^^^ - -.. image:: ./Pictures/10000001000001000000004B8B80A954F09BBF56.png - :width: 6.773cm - :height: 1.984cm - -- **Save database** overwrites the current database, so it is best to - be careful. Due to that, you will need to confirm a prompt before the - changes are saved. -- **Save database as** opens a file browser which can be used to save - the changes in a new file. - -Database menu -^^^^^^^^^^^^^ - -Clicking on Database opens this menu: - -.. image:: ./Pictures/10000001000000A900000052FEACFDD7C67801BA.png - :width: 4.329cm - :height: 1.99cm - -- **New element** allows you to add a new element. -- **New property** allows you to add a new property. - -.. _2d3dplotter: - -2D/3D Plotter -~~~~~~~~~~~~~ - -Upon clicking on the icon, this window will open: - -.. image:: ./Pictures/10000001000003DA000002B772D53BC965757606.png - :width: 12.173cm - :height: 8.58cm - -To use it, a file has to be loaded first. This can be done using the -File menu -> Load, which will open a file browser. Only NetCDF files -(ending in .nc, .cdf, or .netcdf) and HDF5 files (extension .h5 or .hdf) -can be loaded; other file formats will result in an error. - -.. image:: ./Pictures/1000000100000079000000510978F762503F30F6.png - :width: 3.201cm - :height: 2.081cm - -Once a file is loaded, it will appear in the data panel. This is a table -listing all the files loaded in the Plotter, showing the name MDANSE -assigned to the loaded instance (i.e. a key to e.g. distinguish between -files with the same name), the name of the file, and the full path to -the file. - -.. image:: ./Pictures/1000000100000130000000AFA255BACE473AB186.png - :width: 6.645cm - :height: 3.826cm - -Clicking on a loaded file will show all the variables that can be -plotted in the box below, though the whole Plotter window might have to -be resized so that more than one variable shows up at a time. A preview -of the plot of the first variable will also be shown at the bottom, but -only for 1D and 2D plots. - -|image9| - -Once you have selected a variable from the second box, you can select a -plotter from the Select Plotter drop-down menu. The following plotters -are available in MDANSE: - -+---------------------------+-----------+---------------------------+ -| Plotter | Dimension | Description | -+---------------------------+-----------+---------------------------+ -| Line | 1D | A simple plot depicting | -| | | the dependence of one | -| | | variable on another. It | -| | | consists of a single | -| | | line. Uses normal plot() | -| | | function from matplotlib. | -+---------------------------+-----------+---------------------------+ -| Image | 2D | Plots data as an image, | -| | | i.e. on a 2D regular | -| | | raster. Uses matplotlib | -| | | imshow() function. | -+---------------------------+-----------+---------------------------+ -| Elevation | 2D | Plots data as an image. | -| | | Uses VTK. | -+---------------------------+-----------+---------------------------+ -| 2D Slice | 2D | Plots a subset of a 3D | -| | | variable. | -| | | | -+---------------------------+-----------+---------------------------+ -| Isosurface | 3D | A 3D plot depicting a | -| | | surface through lines or | -| | | one continuous surface. | -| | | Uses VTK. | -+---------------------------+-----------+---------------------------+ -| Scalar-Field | 3D | | -| | | | -+---------------------------+-----------+---------------------------+ - -After all that is selected, the data can be plotted. There are two -options for this, represented by the two buttons: - -- **Plot in new window** creates a new tab, ie. a separate plot, inside - the Multiple Plot Window. - -|image10|\ |image11| - -- **Plot in current figure** plots the chosen data in the currently - selected tab of the Multiple Plot Window, ie. it will create a plot - with multiple lines etc. - -|image12|\ |image13| - -As can be seen, the plot automatically adjusts the axes so that all -plots fit. More details on plotting options is in `Appendix -3 <#_Appendix_3_1>`__. - -.. _units-editor: - -Units Editor -~~~~~~~~~~~~ - -When opened, this window will appear: - -.. image:: ./Pictures/1000000100000248000001ECCC3F9A11E0472AF2.png - :width: 9.693cm - :height: 8.167cm - -Here, the units that MDANSE uses can be managed. The white box on the -left is a list of all the defined units, which includes both the units -that come together with MDANSE as well as any user-defined units. More -information on how units work is in the `Units <#_Units>`__ section. -This list is interactive; any unit in it can be clicked on, which -displays its details, like so: - -.. image:: ./Pictures/1000000100000247000001E9C7FFA85698785E9D.png - :width: 9.804cm - :height: 8.142cm - -The fields in the middle and right of the window show the definition of -the selected unit using SI units. The selected unit is equivalent to -**Factor** \* the product of the SI units listed on the right, where the -values inside the fields are the powers of the SI units. Therefore, the -unit shown in the above example, J_per_mole, is in MDANSE defined as -1.66055927342 \* 10\ :sup:`-24` kg m\ :sup:`2` mol\ :sup:`-1`. - -There are four buttons in the Units Editor window: - -- **Cancel** closes the window without saving any changes made. -- **Save** saves the changes for future use; they can be used in the - current session and in any future ones. The Units Editor window is - also closed. -- **OK** saves the changes for the current session; they can be used - until the main MDANSE window is closed. When MDANSE is closed and - opened again, the changes will not appear. The Units Editor window is - also closed. -- **Add unit** opens the following window, which can be used to add new - units or edit existing ones. - -.. image:: ./Pictures/10000001000000C10000017909613E0AF9D5EED0.png - :width: 2.84cm - :height: 5.547cm - -- **Unit name** - -*Format:* str - -*Default:* None - -*Description:* the name of the unit. If a name not yet registered is -inputted, a new unit will be created. Please note that the names are -case-sensitive, and that already existing units cannot be overwritten. - -- **Factor** - -*Format:* float - -*Default:* 1.0 - -*Description:* - -- **unit** (any of the displayed SI basic units) - -*Format:* int (it must lie in the interval ) - -*Default:* 0 - -*Description:* the power of the SI unit. - -- **OK** adds the new definition to the unit registry, but the change - has to be saved in the Units Editor window to be useable in the rest - of MDANSE. Please not that once, a new unit is added, it cannot be - changed only removed. -- **Cancel** closes the window without saving the changes. - -Further, existing units can be deleted from the Units Editor window. To -do this, the unit to be deleted has to be selected by clicking on it, -and then the 'Delete' button has to be clicked. This will show a prompt -for confirmation, and once that is accepted, the unit will be removed, -though the change has to be saved by clicking on either the OK or Cancel -button. - -Data panel ----------- - -This is where files loaded into MDANSE are displayed. Trajectories and -results of analyses are distinctly separated as 'trajectory' and -'Hdf data' respectively. To proceed, you need to double-click on a -file name here to bring it to the Working panel. This can be done -multiple times for each file. - - -Working panel -------------- - -The selected files appear in the Working panel as tabs. The currently -opened tab is the one that whose file is going to be used for analysis -and other operations when using the Plugins panel. - -The Working panel is also the space which some of the plugins use to do -their job. :ref:`molecular-viewer`, -:ref:`analysis-animation`, and :ref:`2d3dplotter` plugins -all load into the `Working panel <#_Working_panel>`__. Furthermore, it -is possible to bring the windows opened by the other plugins into the -working panel, like below. To do that, you have to drag the window so -that its top is near the top of the working panel, where the tabs are. -An indicator will appear when you got it right. - - -Plugins panel -------------- - -This is the heart of MDANSE, where all the analyses as well as other -important features can be found. If the selected tab in the Working -panel is from a trajectory, the Plugins panel will look like this: - - -If it is from the result of an analysis, it will look like this: - -There are far fewer options available for analysis results. -Nevertheless, in each of the sections below, it will be stated if the -plugin appears for trajectories, results, or both. - -All the options in above are just headings. To get to the actual -plugins, click on the 'plus' buttons next to the text to unhide the -options. If there is no such button next to a text, that means that that -is a plugin and can be launched by double-clicking on the text. - - -.. _analysis: - -Analysis --------- - -This menu contains all data manipulations and appears as in the picture -below when a trajectory is loaded. As indicated by the plus buttons, -each of these options is a menu in itself. - -.. image:: ./Pictures/10000001000000F9000000B9A79707AE37EC9465.png - :width: 6.588cm - :height: 4.895cm - -They are explored in greater depth in the following sections, and the -analyses are in turn explored in their subsections. Some contain a -discussion of the theory behind the computation, and all show the -analysis window of that analysis, the one that is launched by -double-clicking the option in this Plugins panel. - -Each analysis window is different since each requires different -parameters to be configured before it can be run. However, all of them -have the same structure (example window below), consisting of these -parts: - -- **trajectory** box shows the path to the :ref:`netcdf` - trajectory that this analysis will - be performed on. - -- **Parameters** are a group of options, of which the common ones are - discussed in depth in :ref:`parameters`. These are the - options which vary from analysis to analysis. The only parameters - that exist on every analysis are Frames and Output files. - -- **Buttons** are situated at the bottom of each analysis and consist - of these options: - - - **Help** opens the source code documentation for the relevant - class in an MDANSE window. - - **Save** opens a file browser that allows you to save the current - analysis with the set options into a python script which can be - run from the command line. More information about scripts in - :ref:`mdanse-cli` and :ref:`mdanse-scripts`. - - **Run** starts the analysis and prompts you whether you want to - close the window. The status of the analysis can be found in the - `Jobs <#_Jobs>`__ panel, though there is a known bug where - successful analyses do not show up. diff --git a/Doc/pages/gui.rst b/Doc/pages/gui.rst index 2ca27a3a62..47716586e3 100644 --- a/Doc/pages/gui.rst +++ b/Doc/pages/gui.rst @@ -2,45 +2,24 @@ Navigating the MDANSE GUI ========================== -The MDANSE Graphical User Interface (GUI) is the central hub for -performing various actions, including opening trajectories, configuring -analysis parameters, and visualizing results. This section provides an -overview of how to effectively utilize the MDANSE GUI. +The MDANSE Graphical User Interface (GUI) is set up to walk the user +through all the steps of the analysis while providing additional +information about each step. Key Actions in the MDANSE GUI ------------------------------ Through the MDANSE GUI, you can perform a range of essential tasks: -- Opening Trajectories: Begin by opening a trajectory, which serves as - the foundation for your analyses. -- Configuring Analysis: Specify the parameters for the analysis you wish - to perform, tailoring it to your research needs. -- Initiating Calculations: Start the calculation process to obtain - insightful results. +- Converting Trajectories: each MD trajectory has to be converted to + an .mdt file, an HDF5 file storing the MDANSE data structures. +- Viewing Trajectories: each .mdt file can be inspected and visualised. +- Performing Analysis: Specify the parameters for the analysis you wish + to perform. Once all the inputs are valid, the analysis can be run. - Plotting Analysis Results: Visualize and interpret the outcomes of your analysis through plots and graphs. -- File Conversions: Perform file conversions, enabling compatibility with - different formats. -- Geometrical Structure Visualization: Explore the geometrical structure - of your calculations for deeper insights. - Creating Input Files and Scripts: Generate input files for the - command-line interface or auto-start analysis Python scripts directly - from the GUI. - -Operating the MDANSE GUI -------------------------- - -The MDANSE GUI offers user-friendly interaction methods, including the -following: - -- Double-Click: You can double-click various objects within the GUI to - trigger actions. -- Drag & Drop: - Simply drag your trajectory into the main GUI window, and a tab will - be created. Drop an analysis operation into the tab to perform the - analysis on the trajectory. Drop the Molecular Viewer into the tab to - visualize the trajectory. + command-line interface. Starting the MDANSE GUI ------------------------------- diff --git a/Doc/pages/installation.rst b/Doc/pages/installation.rst index 825ef5d0c7..22594a007e 100644 --- a/Doc/pages/installation.rst +++ b/Doc/pages/installation.rst @@ -11,7 +11,7 @@ MDANSE Installation To get started with MDANSE, you can follow the MDANSE Installation Tutorial below: -- [MDANSE Installation Tutorial](T_start.rst) +- :ref:`installation_tutorial` Explore the Documentation @@ -29,12 +29,4 @@ Sample Data MDANSE often provides sample datasets that you can use for testing and learning. You can typically find sample -data within the MDANSE GitHub repository. - -
- - GitHub Logo - MDANSE GitHub Repository - -
- +data within the `MDANSE-Examples GitHub repository `_. diff --git a/Doc/pages/introduction.rst b/Doc/pages/introduction.rst index 76bac36cd0..f76d7f71c6 100644 --- a/Doc/pages/introduction.rst +++ b/Doc/pages/introduction.rst @@ -13,13 +13,13 @@ and position auto- and cross-correlation functions, Fourier transformations, and convolutions with instrument parameters, to obtain neutron observables that can be directly compared with experimental data. -MDANSE: Your Gateway to Insights --------------------------------- +Compare Simulation and Experiment Results +----------------------------------------- -Some of these essential steps have been meticulously implemented within MDANSE +Some of these steps have been implemented within MDANSE (Molecular Dynamics Analysis of Neutron Scattering Experiments) [^Ref1^]. This -Python-based application has established connections with more than ten MD codes, -including powerful ab initio MD packages detailed in Trajectory Converters. +Python-based application has established connections with more than ten MD packages, +both those employing classical and ab-initio force calculations. Purpose and Capabilities ------------------------ @@ -36,19 +36,19 @@ Flexibility and Compatibility MDANSE offers: -- A user-friendly Python-based graphical user interface (GUI) for effortless - analysis and visualization. -- Command-line utilities that can be seamlessly integrated into Python scripts - for accessibility and adaptability. -- A molecular viewer and a versatile 2D/3D plotter to enhance the user experience - when dissecting neutron experimental data. +- A Python-based graphical user interface (GUI) via the MDANSE_GUI package, + including a trajectory viewer and a data plotter. +- Command-line utilities for creating and running MDANSE jobs as Python scripts. +- Possiblity of exporting analysis jobs as Python scripts. +- Specialised trajectory converters for specific MD engines. +- A general trajectory converter based on ASE. Your Guide to MDANSE --------------------- This user's guide provides a detailed overview of MDANSE's capabilities, along with theoretical background information and installation instructions for three -different platforms: Windows, Mac OS, and Ubuntu. +different platforms: Windows, MacOS, and Ubuntu. Collaboration and Feedback -------------------------- @@ -61,11 +61,4 @@ GitHub Repository ----------------- You can report issues and make suggestions on our GitHub repository. Please visit -the following link to access the repository: - -
- - GitHub Logo - MDANSE GitHub Repository - -
\ No newline at end of file +the following link to access the `MDANSE GitHub repository `_ diff --git a/Doc/pages/opening.rst b/Doc/pages/opening.rst index 0612e6e7bb..fd08aac909 100644 --- a/Doc/pages/opening.rst +++ b/Doc/pages/opening.rst @@ -5,14 +5,14 @@ MDANSE User Guide **MDANSE (Molecular Dynamics Analysis of Neutron Scattering Experiments)** -User Guide for MDANSE Version 2.0.0 +User Guide for MDANSE Version 2.0.0a1 Ashley Meigh [1]_, Rastislav Turanyi [1]_, Miguel A. Gonzalez [2]_, Eric Pellegrini [2]_, Maciej Bartkowiak [1]_, Sanghamitra Mukhopadhyay [1]_ .. [1] ISIS Neutron and Muon Source, Science and Technology Facilities Council, UKRI .. [2] Institut Laue-Langevin, France -January 2024 +March 2024 .. _cite-mdanse: From 7eae99b569830330beeb5d635bad94af1f72b56a Mon Sep 17 00:00:00 2001 From: Maciej Bartkowiak Date: Wed, 27 Mar 2024 12:01:31 +0000 Subject: [PATCH 02/11] Replace file headers with GPL-compliant headers --- MDANSE/Src/MDANSE/Chemistry/ChemicalEntity.py | 16 +- MDANSE/Src/MDANSE/Chemistry/Databases.py | 24 +- MDANSE/Src/MDANSE/Chemistry/Structrures.py | 16 + MDANSE/Src/MDANSE/Chemistry/__init__.py | 15 + MDANSE/Src/MDANSE/Core/Error.py | 24 +- MDANSE/Src/MDANSE/Core/Platform.py | 1218 +++++++++-------- MDANSE/Src/MDANSE/Core/Singleton.py | 72 +- MDANSE/Src/MDANSE/Core/SubclassFactory.py | 24 +- MDANSE/Src/MDANSE/Core/__init__.py | 24 +- MDANSE/Src/MDANSE/Extensions/__init__.py | 24 +- .../MDANSE/Framework/AtomMapping/__init__.py | 15 + .../Framework/AtomMapping/atom_mapping.py | 17 +- .../MDANSE/Framework/AtomSelector/__init__.py | 15 + .../Framework/AtomSelector/all_selector.py | 15 + .../Framework/AtomSelector/atom_selectors.py | 15 + .../Framework/AtomSelector/group_selectors.py | 16 +- .../AtomSelector/molecule_selectors.py | 15 + .../MDANSE/Framework/AtomSelector/selector.py | 16 +- MDANSE/Src/MDANSE/Framework/Configurable.py | 24 +- .../Configurators/ASEFileConfigurator.py | 24 +- .../Configurators/AseInputFileConfigurator.py | 24 +- .../Configurators/AtomMappingConfigurator.py | 24 +- .../AtomSelectionConfigurator.py | 272 ++-- .../AtomTransmutationConfigurator.py | 288 ++-- .../Configurators/AtomsListConfigurator.py | 238 ++-- .../AxisSelectionConfigurator.py | 178 +-- .../BasisSelectionConfigurator.py | 172 +-- .../Configurators/BooleanConfigurator.py | 152 +- .../Configurators/ConfigFileConfigurator.py | 24 +- .../Configurators/FieldFileConfigurator.py | 24 +- .../FileWithAtomDataConfigurator.py | 15 + .../Configurators/FloatConfigurator.py | 258 ++-- .../Configurators/FramesConfigurator.py | 220 +-- .../GroupingLevelConfigurator.py | 352 ++--- .../Configurators/HDFInputFileConfigurator.py | 262 ++-- .../HDFTrajectoryConfigurator.py | 184 +-- .../Framework/Configurators/IConfigurator.py | 602 ++++---- .../InputDirectoryConfigurator.py | 114 +- .../Configurators/InputFileConfigurator.py | 174 +-- .../InstrumentResolutionConfigurator.py | 234 ++-- .../Configurators/IntegerConfigurator.py | 276 ++-- .../InterpolationOrderConfigurator.py | 144 +- .../Configurators/MDFileConfigurator.py | 24 +- .../MDMCTrajectoryConfigurator.py | 24 +- .../McStasInstrumentConfigurator.py | 24 +- .../McStasOptionsConfigurator.py | 222 +-- .../McStasParametersConfigurator.py | 254 ++-- .../MockTrajectoryConfigurator.py | 24 +- .../MultipleChoicesConfigurator.py | 214 +-- .../OutputDirectoryConfigurator.py | 152 +- .../Configurators/OutputFilesConfigurator.py | 278 ++-- .../OutputTrajectoryConfigurator.py | 24 +- .../PartialChargeConfigurator.py | 184 +-- .../Configurators/ProjectionConfigurator.py | 176 +-- .../Configurators/PythonObjectConfigurator.py | 126 +- .../Configurators/PythonScriptConfigurator.py | 160 +-- .../Configurators/QVectorsConfigurator.py | 236 ++-- .../Configurators/RangeConfigurator.py | 440 +++--- .../Configurators/RunningModeConfigurator.py | 174 +-- .../Configurators/SingleChoiceConfigurator.py | 164 +-- .../SingleOutputFileConfigurator.py | 266 ++-- .../Configurators/StringConfigurator.py | 216 +-- .../TrajectoryVariableConfigurator.py | 122 +- .../Configurators/VectorConfigurator.py | 292 ++-- .../Configurators/WeightsConfigurator.py | 194 +-- .../Configurators/XDATCARFileConfigurator.py | 24 +- .../Configurators/XTDFileConfigurator.py | 24 +- .../Configurators/XYZFileConfigurator.py | 24 +- .../Framework/Configurators/__init__.py | 24 +- MDANSE/Src/MDANSE/Framework/Converters/ASE.py | 24 +- .../Src/MDANSE/Framework/Converters/CASTEP.py | 344 ++--- .../Src/MDANSE/Framework/Converters/CHARMM.py | 24 +- .../Src/MDANSE/Framework/Converters/CP2K.py | 24 +- .../MDANSE/Framework/Converters/Converter.py | 24 +- MDANSE/Src/MDANSE/Framework/Converters/DCD.py | 788 +++++------ .../Src/MDANSE/Framework/Converters/DFTB.py | 24 +- .../MDANSE/Framework/Converters/DL_POLY.py | 748 +++++----- .../Src/MDANSE/Framework/Converters/DMol.py | 24 +- .../MDANSE/Framework/Converters/Discover.py | 790 +++++------ .../MDANSE/Framework/Converters/Forcite.py | 842 ++++++------ .../MDANSE/Framework/Converters/Gromacs.py | 404 +++--- .../Framework/Converters/ImprovedASE.py | 24 +- .../Src/MDANSE/Framework/Converters/LAMMPS.py | 754 +++++----- .../Src/MDANSE/Framework/Converters/NAMD.py | 24 +- .../Src/MDANSE/Framework/Converters/VASP.py | 24 +- .../Src/MDANSE/Framework/Converters/XPLOR.py | 24 +- .../MDANSE/Framework/Converters/__init__.py | 24 +- .../Src/MDANSE/Framework/Formats/HDFFormat.py | 24 +- .../Src/MDANSE/Framework/Formats/IFormat.py | 24 +- .../Src/MDANSE/Framework/Formats/MDAFormat.py | 15 + .../Src/MDANSE/Framework/Formats/MDTFormat.py | 15 + .../Src/MDANSE/Framework/Formats/SVGFormat.py | 24 +- .../MDANSE/Framework/Formats/TextFormat.py | 24 +- .../Src/MDANSE/Framework/Formats/__init__.py | 24 +- .../Handlers/ColorizingStreamHandler.py | 24 +- .../Src/MDANSE/Framework/Handlers/IHandler.py | 24 +- .../Framework/Handlers/LogfileHandler.py | 24 +- .../Src/MDANSE/Framework/Handlers/__init__.py | 24 +- .../MDANSE/Framework/InputData/EmptyData.py | 24 +- .../InputData/HDFTrajectoryInputData.py | 24 +- .../MDANSE/Framework/InputData/IInputData.py | 24 +- .../Framework/InputData/InputFileData.py | 24 +- .../Framework/InputData/MVITraceInputData.py | 24 +- .../InputData/MockTrajectoryInputData.py | 24 +- .../InputData/PeriodicTableInputData.py | 24 +- .../MDANSE/Framework/InputData/__init__.py | 24 +- .../InstrumentResolutions/Gaussian.py | 88 +- .../IInstrumentResolution.py | 108 +- .../Framework/InstrumentResolutions/Ideal.py | 76 +- .../InstrumentResolutions/Lorentzian.py | 88 +- .../InstrumentResolutions/PseudoVoigt.py | 108 +- .../Framework/InstrumentResolutions/Square.py | 94 +- .../InstrumentResolutions/Triangular.py | 90 +- .../InstrumentResolutions/__init__.py | 24 +- .../Framework/Jobs/AngularCorrelation.py | 24 +- .../MDANSE/Framework/Jobs/AreaPerMolecule.py | 326 ++--- .../Jobs/CenterOfMassesTrajectory.py | 328 ++--- .../Framework/Jobs/CoordinationNumber.py | 408 +++--- .../Framework/Jobs/CroppedTrajectory.py | 260 ++-- .../Jobs/CurrentCorrelationFunction.py | 1194 ++++++++-------- MDANSE/Src/MDANSE/Framework/Jobs/Density.py | 24 +- .../MDANSE/Framework/Jobs/DensityOfStates.py | 480 +++---- .../MDANSE/Framework/Jobs/DensityProfile.py | 392 +++--- .../Jobs/DipoleAutoCorrelationFunction.py | 24 +- .../Framework/Jobs/DistanceHistogram.py | 428 +++--- .../Jobs/DynamicCoherentStructureFactor.py | 580 ++++---- .../Jobs/DynamicIncoherentStructureFactor.py | 554 ++++---- .../Src/MDANSE/Framework/Jobs/Eccentricity.py | 24 +- .../Jobs/ElasticIncoherentStructureFactor.py | 408 +++--- ...aussianDynamicIncoherentStructureFactor.py | 24 +- .../Jobs/GeneralAutoCorrelationFunction.py | 24 +- .../Jobs/GlobalMotionFilteredTrajectory.py | 422 +++--- MDANSE/Src/MDANSE/Framework/Jobs/IJob.py | 24 +- MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py | 24 +- .../Framework/Jobs/McStasVirtualInstrument.py | 1088 +++++++-------- .../Framework/Jobs/MeanSquareDisplacement.py | 24 +- .../MDANSE/Framework/Jobs/MolecularTrace.py | 24 +- .../MDANSE/Framework/Jobs/MoleculeFinder.py | 24 +- .../NeutronDynamicTotalStructureFactor.py | 916 +++++++------ .../MDANSE/Framework/Jobs/OrderParameter.py | 536 ++++---- .../Jobs/PairDistributionFunction.py | 360 ++--- .../Jobs/PositionAutoCorrelationFunction.py | 24 +- .../MDANSE/Framework/Jobs/RadiusOfGyration.py | 276 ++-- .../Framework/Jobs/RigidBodyTrajectory.py | 24 +- .../Framework/Jobs/RootMeanSquareDeviation.py | 350 ++--- .../Jobs/RootMeanSquareFluctuation.py | 282 ++-- .../Jobs/SolventAccessibleSurface.py | 24 +- .../Framework/Jobs/StaticStructureFactor.py | 414 +++--- .../StructureFactorFromScatteringFunction.py | 300 ++-- .../Src/MDANSE/Framework/Jobs/Temperature.py | 24 +- .../Framework/Jobs/UnfoldedTrajectory.py | 24 +- .../Jobs/VelocityAutoCorrelationFunction.py | 456 +++--- MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py | 24 +- .../Jobs/XRayStaticStructureFactor.py | 436 +++--- MDANSE/Src/MDANSE/Framework/Jobs/__init__.py | 24 +- .../OutputVariables/IOutputVariable.py | 24 +- .../OutputVariables/LineOutputVariable.py | 24 +- .../OutputVariables/SurfaceOutputVariable.py | 24 +- .../OutputVariables/VolumeOutputVariable.py | 24 +- .../Framework/OutputVariables/__init__.py | 24 +- .../Framework/Projectors/AxialProjector.py | 24 +- .../MDANSE/Framework/Projectors/IProjector.py | 24 +- .../Framework/Projectors/NullProjector.py | 24 +- .../Framework/Projectors/PlanarProjector.py | 24 +- .../MDANSE/Framework/Projectors/__init__.py | 24 +- .../QVectors/ApproximateDispersionQVectors.py | 188 +-- .../QVectors/CircularLatticeQVectors.py | 248 ++-- .../Framework/QVectors/CircularQVectors.py | 178 +-- .../QVectors/DispersionLatticeQVectors.py | 148 +- .../MDANSE/Framework/QVectors/GridQVectors.py | 196 +-- .../MDANSE/Framework/QVectors/IQVectors.py | 102 +- .../Framework/QVectors/LatticeQVectors.py | 86 +- .../QVectors/LinearLatticeQVectors.py | 220 +-- .../Framework/QVectors/LinearQVectors.py | 156 ++- .../QVectors/MillerIndicesQVectors.py | 222 +-- .../QVectors/SphericalLatticeQVectors.py | 24 +- .../Framework/QVectors/SphericalQVectors.py | 146 +- .../Src/MDANSE/Framework/QVectors/__init__.py | 24 +- .../Framework/Session/CurrentSession.py | 24 +- MDANSE/Src/MDANSE/Framework/Status.py | 24 +- MDANSE/Src/MDANSE/Framework/Units.py | 16 +- .../MDANSE/Framework/UserDefinitionStore.py | 24 +- MDANSE/Src/MDANSE/Framework/__init__.py | 24 +- MDANSE/Src/MDANSE/IO/FortranFormat.py | 28 +- MDANSE/Src/MDANSE/IO/HDF.py | 16 +- MDANSE/Src/MDANSE/IO/HDF5.py | 24 +- MDANSE/Src/MDANSE/IO/IOUtils.py | 24 +- MDANSE/Src/MDANSE/IO/PDB.py | 16 +- MDANSE/Src/MDANSE/IO/PDBExportFilters.py | 18 +- MDANSE/Src/MDANSE/IO/PDBReader.py | 16 +- MDANSE/Src/MDANSE/IO/PDBSpaceGroups.py | 16 +- MDANSE/Src/MDANSE/IO/TextFile.py | 16 +- MDANSE/Src/MDANSE/IO/__init__.py | 24 +- MDANSE/Src/MDANSE/Mathematics/Arithmetic.py | 142 +- MDANSE/Src/MDANSE/Mathematics/Geometry.py | 526 +++---- MDANSE/Src/MDANSE/Mathematics/Graph.py | 24 +- .../Src/MDANSE/Mathematics/LinearAlgebra.py | 18 +- MDANSE/Src/MDANSE/Mathematics/Signal.py | 576 ++++---- .../Src/MDANSE/Mathematics/Transformation.py | 18 +- MDANSE/Src/MDANSE/Mathematics/__init__.py | 24 +- .../Src/MDANSE/MolecularDynamics/Analysis.py | 24 +- .../MDANSE/MolecularDynamics/Configuration.py | 17 +- .../MDANSE/MolecularDynamics/Connectivity.py | 22 +- .../MolecularDynamics/MockTrajectory.py | 22 +- .../MDANSE/MolecularDynamics/Trajectory.py | 22 +- .../MolecularDynamics/TrajectoryUtils.py | 22 +- .../Src/MDANSE/MolecularDynamics/UnitCell.py | 15 + .../Src/MDANSE/MolecularDynamics/__init__.py | 24 +- .../NeutronInstruments/Coverage/Coverage.py | 24 +- .../Coverage/TotalCoverage.py | 24 +- .../NeutronInstruments/Coverage/__init__.py | 24 +- .../NeutronInstruments/IdealInstrument.py | 24 +- .../NeutronInstruments/Method/NullMethod.py | 24 +- .../Method/ScatteringMethod.py | 24 +- .../Method/TOFDiffraction.py | 24 +- .../NeutronInstruments/Method/__init__.py | 24 +- .../NeutronInstruments/NeutronInstrument.py | 24 +- .../Resolution/IdealResolution.py | 24 +- .../Resolution/Resolution.py | 24 +- .../NeutronInstruments/Resolution/__init__.py | 24 +- .../Spectrum/FlatSpectrum.py | 24 +- .../NeutronInstruments/Spectrum/Spectrum.py | 24 +- .../NeutronInstruments/Spectrum/__init__.py | 24 +- .../Src/MDANSE/NeutronInstruments/__init__.py | 24 +- MDANSE/Src/MDANSE/Scripts/__init__.py | 15 + MDANSE/Src/MDANSE/Scripts/mdanse.py | 24 +- MDANSE/Src/MDANSE/Scripts/mdanse_job.py | 24 +- MDANSE/Src/MDANSE/__init__.py | 24 +- MDANSE/Src/MDANSE/__pkginfo__.py | 24 +- MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py | 24 +- .../MDANSE_GUI/DataViewModel/ActionsHolder.py | 24 +- .../Src/MDANSE_GUI/DataViewModel/JobHolder.py | 24 +- .../MDANSE_GUI/DataViewModel/JobStatusQt.py | 24 +- .../DataViewModel/TrajectoryHolder.py | 24 +- .../Src/MDANSE_GUI/DataViewModel/__init__.py | 24 +- .../Src/MDANSE_GUI/ElementsDatabaseEditor.py | 24 +- MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py | 24 +- .../InputWidgets/AseInputFileWidget.py | 24 +- .../InputWidgets/AtomMappingWidget.py | 24 +- .../InputWidgets/AtomSelectionWidget.py | 728 +++++----- .../InputWidgets/AtomTransmutationWidget.py | 130 +- .../MDANSE_GUI/InputWidgets/BackupWidget.py | 24 +- .../MDANSE_GUI/InputWidgets/BooleanWidget.py | 116 +- .../MDANSE_GUI/InputWidgets/ComboWidget.py | 130 +- .../MDANSE_GUI/InputWidgets/DummyWidget.py | 24 +- .../MDANSE_GUI/InputWidgets/FloatWidget.py | 168 +-- .../MDANSE_GUI/InputWidgets/FramesWidget.py | 200 +-- .../InputWidgets/HDFTrajectoryWidget.py | 134 +- .../InputWidgets/InputDirectoryWidget.py | 58 +- .../InputWidgets/InputFileWidget.py | 190 +-- .../InstrumentResolutionWidget.py | 292 ++-- .../MDANSE_GUI/InputWidgets/IntegerWidget.py | 160 +-- .../InputWidgets/InterpolationOrderWidget.py | 164 +-- .../InputWidgets/OutputDirectoryWidget.py | 24 +- .../InputWidgets/OutputFilesWidget.py | 348 ++--- .../InputWidgets/OutputTrajectoryWidget.py | 24 +- .../InputWidgets/ProjectionWidget.py | 168 +-- .../MDANSE_GUI/InputWidgets/QVectorsWidget.py | 246 ++-- .../MDANSE_GUI/InputWidgets/RangeWidget.py | 24 +- .../InputWidgets/RunningModeWidget.py | 168 +-- .../MDANSE_GUI/InputWidgets/StringWidget.py | 136 +- .../Src/MDANSE_GUI/InputWidgets/WidgetBase.py | 24 +- .../Src/MDANSE_GUI/InputWidgets/__init__.py | 24 +- .../MolecularViewer/AtomProperties.py | 22 +- .../MolecularViewer/ColourManager.py | 22 +- .../MDANSE_GUI/MolecularViewer/Contents.py | 22 +- .../MDANSE_GUI/MolecularViewer/Controls.py | 22 +- .../Src/MDANSE_GUI/MolecularViewer/Dummy.py | 22 +- .../MolecularViewer/MolecularViewer.py | 22 +- .../MDANSE_GUI/MolecularViewer/__init__.py | 22 +- .../MolecularViewer/database/__init__.py | 22 +- .../MolecularViewer/readers/__init__.py | 17 +- .../MolecularViewer/readers/hdf5wrapper.py | 22 +- .../MolecularViewer/readers/i_reader.py | 22 +- .../readers/reader_registry.py | 23 +- .../Src/MDANSE_GUI/PeriodicTableViewer.py | 24 +- MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py | 22 +- .../MDANSE_GUI/Plotter/dialogs/__init__.py | 15 + .../Plotter/dialogs/about_dialog.py | 22 +- .../Plotter/dialogs/cross_viewer_dialog.py | 22 +- .../Plotter/dialogs/data_viewer_1d_dialog.py | 22 +- .../Plotter/dialogs/data_viewer_nd_dialog.py | 22 +- .../Plotter/dialogs/inspect_data_dialog.py | 22 +- .../dialogs/plot_1d_axis_settings_dialog.py | 22 +- .../plot_1d_general_settings_dialog.py | 22 +- .../dialogs/plot_1d_lines_settings_dialog.py | 22 +- .../plot_2d_general_settings_dialog.py | 22 +- .../dialogs/plot_2d_image_settings_dialog.py | 22 +- .../dialogs/plot_nd_axis_settings_dialog.py | 22 +- .../plot_nd_general_settings_dialog.py | 22 +- .../dialogs/plot_nd_image_settings_dialog.py | 22 +- .../Plotter/dialogs/slice_viewer_dialog.py | 22 +- .../Plotter/dialogs/units_editor_dialog.py | 22 +- .../Plotter/dialogs/viewer_1d_dialog.py | 22 +- .../MDANSE_GUI/Plotter/handlers/__init__.py | 15 + .../Plotter/handlers/logger_popup.py | 22 +- .../Plotter/handlers/logger_widget.py | 22 +- .../Src/MDANSE_GUI/Plotter/models/__init__.py | 15 + .../Plotter/models/data_list_model.py | 22 +- .../Plotter/models/data_tree_model.py | 22 +- .../Plotter/models/plot_1d_model.py | 22 +- .../Plotter/models/plot_2d_model.py | 22 +- .../Plotter/models/plot_nd_model.py | 22 +- .../Src/MDANSE_GUI/Plotter/utils/__init__.py | 15 + .../Src/MDANSE_GUI/Plotter/utils/numeric.py | 25 +- .../MDANSE_GUI/Plotter/utils/sorted_dict.py | 23 +- .../MDANSE_GUI/Plotter/utils/sorted_list.py | 23 +- .../MDANSE_GUI/Plotter/utils/sorted_set.py | 23 +- .../Src/MDANSE_GUI/Plotter/views/__init__.py | 15 + .../MDANSE_GUI/Plotter/views/table_views.py | 22 +- .../MDANSE_GUI/Plotter/widgets/__init__.py | 15 + .../Plotter/widgets/actions_widget.py | 22 +- .../MDANSE_GUI/Plotter/widgets/data_widget.py | 22 +- .../Plotter/widgets/datasets_widget.py | 22 +- .../Plotter/widgets/logger_widget.py | 22 +- .../MDANSE_GUI/Plotter/widgets/main_window.py | 22 +- .../Plotter/widgets/plot_1d_widget.py | 22 +- .../Plotter/widgets/plot_2d_widget.py | 22 +- .../Plotter/widgets/plot_actions_widget.py | 22 +- .../Plotter/widgets/plot_nd_widget.py | 22 +- .../Plotter/widgets/preview_widget.py | 22 +- .../Plotter/widgets/range_slider.py | 23 +- MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py | 24 +- MDANSE_GUI/Src/MDANSE_GUI/Resources.py | 24 +- MDANSE_GUI/Src/MDANSE_GUI/Scripts/__init__.py | 15 + .../Scripts/mdanse_elements_database.py | 24 +- .../Src/MDANSE_GUI/Scripts/mdanse_gui.py | 24 +- .../Scripts/mdanse_periodic_table.py | 24 +- .../Src/MDANSE_GUI/Scripts/mdanse_plotter.py | 24 +- .../MDANSE_GUI/Scripts/mdanse_units_editor.py | 24 +- .../Src/MDANSE_GUI/Session/LocalSession.py | 17 +- MDANSE_GUI/Src/MDANSE_GUI/Session/Logger.py | 16 + MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py | 16 + MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py | 24 +- .../Src/MDANSE_GUI/Subprocess/JobState.py | 15 + .../MDANSE_GUI/Subprocess/JobStatusProcess.py | 24 +- .../Src/MDANSE_GUI/Subprocess/Subprocess.py | 24 +- .../Src/MDANSE_GUI/Subprocess/__init__.py | 15 + MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py | 24 +- .../Src/MDANSE_GUI/Tabs/ConverterTab.py | 24 +- MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py | 29 +- MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py | 24 +- .../MDANSE_GUI/Tabs/Layouts/DoublePanel.py | 24 +- .../MDANSE_GUI/Tabs/Layouts/SinglePanel.py | 24 +- .../MDANSE_GUI/Tabs/Layouts/TriplePanel.py | 24 +- .../Src/MDANSE_GUI/Tabs/Layouts/__init__.py | 15 + MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py | 24 +- .../MDANSE_GUI/Tabs/Models/GeneralModel.py | 15 + .../Src/MDANSE_GUI/Tabs/Models/JobHolder.py | 24 +- .../Src/MDANSE_GUI/Tabs/Models/JobTree.py | 15 + .../Src/MDANSE_GUI/Tabs/Models/__init__.py | 15 + MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py | 24 +- .../MDANSE_GUI/Tabs/Settings/LocalSettings.py | 15 + .../Src/MDANSE_GUI/Tabs/Settings/__init__.py | 15 + .../Src/MDANSE_GUI/Tabs/TrajectoryTab.py | 24 +- .../Src/MDANSE_GUI/Tabs/Views/ActionsTree.py | 24 +- .../Src/MDANSE_GUI/Tabs/Views/RunTable.py | 24 +- .../MDANSE_GUI/Tabs/Views/TrajectoryView.py | 24 +- .../Src/MDANSE_GUI/Tabs/Views/__init__.py | 15 + .../Src/MDANSE_GUI/Tabs/Visualisers/Action.py | 24 +- .../Tabs/Visualisers/AnalysisInfo.py | 15 + .../MDANSE_GUI/Tabs/Visualisers/TextInfo.py | 15 + .../Tabs/Visualisers/TrajectoryInfo.py | 15 + .../Src/MDANSE_GUI/Tabs/Visualisers/View3D.py | 16 +- .../MDANSE_GUI/Tabs/Visualisers/__init__.py | 15 + MDANSE_GUI/Src/MDANSE_GUI/Tabs/__init__.py | 15 + MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py | 24 +- .../Src/MDANSE_GUI/Widgets/ConvertDialog.py | 25 +- .../Src/MDANSE_GUI/Widgets/ConvertWizard.py | 25 +- .../Src/MDANSE_GUI/Widgets/GeneralWidgets.py | 25 +- .../Src/MDANSE_GUI/Widgets/Generator.py | 25 +- .../Src/MDANSE_GUI/Widgets/LoaderButton.py | 25 +- .../Src/MDANSE_GUI/Widgets/Oscillator.py | 25 +- .../Src/MDANSE_GUI/Widgets/StyleDialog.py | 25 +- .../MDANSE_GUI/Widgets/TrajectoryViewer.py | 25 +- MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py | 25 +- MDANSE_GUI/Src/MDANSE_GUI/__init__.py | 24 +- MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py | 24 +- MDANSE_GUI/Src/MDANSE_GUI/main.py | 24 +- 379 files changed, 20271 insertions(+), 18249 deletions(-) diff --git a/MDANSE/Src/MDANSE/Chemistry/ChemicalEntity.py b/MDANSE/Src/MDANSE/Chemistry/ChemicalEntity.py index 9ae353da65..2c6ac7f7ea 100644 --- a/MDANSE/Src/MDANSE/Chemistry/ChemicalEntity.py +++ b/MDANSE/Src/MDANSE/Chemistry/ChemicalEntity.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from __future__ import annotations import abc from ast import literal_eval @@ -1889,7 +1904,6 @@ def __init__(self, name: str): self._residues = [] def _connect_residues(self) -> None: - # Process the first atom ratoms_in_first_residue = [ at for at in self._residues[0].atom_list diff --git a/MDANSE/Src/MDANSE/Chemistry/Databases.py b/MDANSE/Src/MDANSE/Chemistry/Databases.py index f04d83cb26..c6aa47f69f 100644 --- a/MDANSE/Src/MDANSE/Chemistry/Databases.py +++ b/MDANSE/Src/MDANSE/Chemistry/Databases.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Data/ElementsDatabase.py -# @brief Implements module/class/test ElementsDatabase +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import copy import os diff --git a/MDANSE/Src/MDANSE/Chemistry/Structrures.py b/MDANSE/Src/MDANSE/Chemistry/Structrures.py index ac31c657f2..8690aea0d5 100644 --- a/MDANSE/Src/MDANSE/Chemistry/Structrures.py +++ b/MDANSE/Src/MDANSE/Chemistry/Structrures.py @@ -1,3 +1,19 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + from io import StringIO import numpy as np diff --git a/MDANSE/Src/MDANSE/Chemistry/__init__.py b/MDANSE/Src/MDANSE/Chemistry/__init__.py index d9935787d8..bc01a1b002 100644 --- a/MDANSE/Src/MDANSE/Chemistry/__init__.py +++ b/MDANSE/Src/MDANSE/Chemistry/__init__.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from MDANSE.Chemistry.Databases import ( AtomsDatabase, MoleculesDatabase, diff --git a/MDANSE/Src/MDANSE/Core/Error.py b/MDANSE/Src/MDANSE/Core/Error.py index 66bacdaafe..b1132a772b 100644 --- a/MDANSE/Src/MDANSE/Core/Error.py +++ b/MDANSE/Src/MDANSE/Core/Error.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Core/Error.py -# @brief Implements module/class/test Error +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) class Error(Exception): diff --git a/MDANSE/Src/MDANSE/Core/Platform.py b/MDANSE/Src/MDANSE/Core/Platform.py index e037650ddd..0bb119e05e 100644 --- a/MDANSE/Src/MDANSE/Core/Platform.py +++ b/MDANSE/Src/MDANSE/Core/Platform.py @@ -1,607 +1,611 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Core/Platform.py -# @brief Implements module/class/test Platform -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import abc -import ctypes -import datetime -import getpass -import inspect -import os -import re -import subprocess - -from MDANSE.Core.Error import Error - - -class PlatformError(Error): - """ - This class handles error related to Platform derived classes. - """ - - pass - - -class Platform(object, metaclass=abc.ABCMeta): - """ - This is the base class for OS-free standard operations. - """ - - __instance = None - - def __new__(cls, *args, **kwargs): - """ - Create a new instance of Platform class. - - :param cls: the class to instanciate. - :type cls: class - """ - - # Case of the first instanciation. - if cls.__instance is None: - cls.__instance = super(Platform, cls).__new__(cls, *args, **kwargs) - - return cls.__instance - - @abc.abstractmethod - def application_directory(self): - """ - Returns the path for MDANSE application directory. - - The directory data used by MDANSE for storing preferences, databses, jobs temporary files ... - - :return: the path for MDANSE application directory. - :rtype: str - """ - pass - - def doc_path(self): - """ - Returns the path for MDANSE documentation root directory. - - :return: the path for MDANSE documentation root directory - :rtype: str - """ - - return os.path.join(self.package_directory(), "Doc") - - def jobs_launch_delay(self): - """ - Returns the delay (in seconds) for a job to launch. - This is used to determine the delay before updating the GUI and suppressing a job status file - - :return: the delay (in seconds) for a job to launch - :rtype: float - """ - return 2.0 - - def api_path(self): - """ - Returns the path for MDANSE HTML API. - - :return: the path for MDANSE HTML documentation - :rtype: str - """ - - return os.path.join(self.package_directory(), "Doc", "api", "html") - - def help_path(self): - """ - Returns the path for MDANSE HTML help. - - :return: the path for MDANSE HTML documentation - :rtype: str - """ - - return os.path.join(self.package_directory(), "Doc", "help", "html") - - def full_dotted_module(self, obj): - """ - Returns the fully dotted name of a module given the module object itself or a class stored in this module. - - :param obj: the module object or a class stored in stored in this module. - :type obj: module or class - - :return: the fully dotted name of the module. - :rtype: str - """ - - if inspect.ismodule(obj): - path = obj.__file__ - elif inspect.isclass(obj): - path = inspect.getmodule(obj).__file__ - else: - raise PlatformError("Invalid query object type.") - - basepath = os.path.join(os.path.dirname(self.package_directory()), "") - - s = path.split(basepath) - if len(s) != 2: - return None - - _, relativePath = path.split(basepath) - - relativePath = os.path.splitext(relativePath)[0] - - return ".".join(relativePath.split(os.path.sep)) - - def change_directory(self, directory): - """ - Change the current directory to a new directory. - - :param directory: the new directory - :type directory: str - """ - - os.chdir(directory) - - def is_directory_writable(self, path): - """ - Check whether a given directory is writable. - - :param path: the directory to be tested for writable status - :type path: str - - :return: true if the directory is writable, false otherwise - :rtype: bool - """ - - # Gets an absolute version of the path to check - path = self.get_path(path) - - return os.access(path, os.W_OK | os.X_OK) - - def create_directory(self, path): - """ - Creates a directory. - - :param path: the path of the directory to create - :type path: str - """ - - path = self.get_path(path) - - if os.path.exists(path): - return - - # Try to make the directory. - try: - os.makedirs(path) - - # An error occured. - except OSError as e: - raise PlatformError( - "The following exception was raised while trying to create a directory at " - "{0}: /n {1}".format(str(path), e) - ) - - def get_path(self, path): - """ - Return a normalized and absolute version of a given path - - :param path: the path of the file to be normalized and made absolute - :type path: str - - :return: the normalized and absolute version of the input path - :rtype: str - """ - - path = str(path).encode("unicode-escape") - - path = os.path.abspath(os.path.expanduser(path)).decode("utf-8") - - return path - - def database_default_path(self): - """ - Returns the path for the default MDANSE elements database. - - :return: the MDANSE default elements database path - :rtype: string - """ - - return os.path.join(self.package_directory(), "Data", "elements_database.csv") - - def database_user_path(self): - """ - Returns the path for user MDANSE elements database. - - :return: the MDANSE user elements database path. - :rtype: string - """ - - return os.path.join(self.application_directory(), "elements_database.csv") - - @abc.abstractmethod - def get_processes_info(self): - """ - Returns the current active processes. - - :return: a mapping between active processes pid and their corresponding process name. - :rtype: dict - """ - pass - - @abc.abstractmethod - def kill_process(self, pid): - """ - Kill a specified process. - - :param pid: the pid of the process to be killed. - :type pid: int - """ - pass - - def pid(self): - """ - Return the pid of the process that currently runs MDANSE. - - :return: the pid of the process running MDANSE - :rtype: int - """ - - return os.getpid() - - def example_data_directory(self): - """ - Returns the path for MDANSE example data (samples of trajectories, McStas files ...). - - :return: the path for MDANSE example files - :rtype: str - """ - - return os.path.join(os.path.dirname(self.package_directory()), "Data") - - def base_directory(self): - """ - Returns the path for MDANSE base directory. - - @return: the path for MDANSE base directory. - @rtype: str - """ - - return os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - - def package_directory(self): - """ - Returns the path for MDANSE package. - - @return: the path for MDANSE package. - @rtype: str - """ - - return os.path.dirname(os.path.dirname(__file__)) - - def macros_directory(self): - """ - Returns the path of the directory where the MDANSE macros will be searched. - - :return: the path of the directory where the MDANSE macros will be searched. - :rtype: str - """ - - macrosDir = os.path.join(self.application_directory(), "macros") - - return macrosDir - - def logfiles_directory(self): - """ - Returns the path of the directory where the MDANSE job logfiles are stored. - - :return: the path of the directory where the MDANSE job logfiles are stored. - :rtype: str - """ - - path = os.path.join(self.application_directory(), "logfiles") - - self.create_directory(path) - - return path - - def temporary_files_directory(self): - """ - Returns the path of the directory where the temporary MDANSE job status files are stored. - - :return: the path of the directory where the temporary MDANSE job status files are stored - :rtype: str - """ - - path = os.path.join(self.application_directory(), "temporary_files") - - self.create_directory(path) - - return path - - def username(self): - """ - Returns the name of the user that run MDANSE. - - @return: the name of the user - @rtype: str - """ - - return getpass.getuser().lower() - - @abc.abstractmethod - def home_directory(self): - """ - Returns the home directory of the user that runs MDANSE. - - @return: the home directory - @rtype: str - """ - pass - - -class PlatformPosix(Platform): - """ - Base class for POSIX derived OS. - """ - - def home_directory(self): - """ - Returns the home directory of the user that runs MDANSE. - - @return: the home directory - @rtype: str - """ - - return os.environ["HOME"] - - def kill_process(self, pid): - """ - Kill a specified process. - - :param pid: the pid of the process to be killed. - :type pid: int - """ - - import signal - - os.kill(pid, signal.SIGTERM) - - def application_directory(self): - """ - Returns the path for MDANSE application directory. - - The directory data used by MDANSE for storing preferences, databses, jobs temporary files ... - - :return: the path for MDANSE application directory. - :rtype: str - """ - - basedir = os.path.join(os.environ["HOME"], ".mdanse") - - # If the application directory does not exist, create it. - if not os.path.exists(basedir): - os.makedirs(basedir) - - return basedir - - def etime_to_ctime(self, etime): - """ - Converts the elapsed time (i.e. as output by ps unix command) to local time. - - :param etime: the elapsed time - :type etime: str - - :return: the local time - :rtype: str - """ - - etime = [0, 0, 0] + [int(v) for v in re.split("-|:", etime)] - - days, hours, minutes, seconds = etime[-4:] - - etime = datetime.timedelta( - days=days, hours=hours, minutes=minutes, seconds=seconds - ) - - return (datetime.datetime.today() - etime).strftime("%d-%m-%Y %H:%M:%S") - - def get_processes_info(self): - """ - Returns the current active processes. - - :return: a mapping between active processes pid and their corresponding process name. - :rtype: dict - """ - - # Get all the active processes using the Unix ps command - procs = subprocess.Popen(["ps", "-eo", "pid,etime"], stdout=subprocess.PIPE) - - # The output of the ps command is splitted according to line feeds. - procs = procs.communicate()[0].decode("utf-8").split("\n")[1:] - - # The list of (pid,executable). - procs = [p.split() for p in procs if p] - - # A mapping between the active processes pid and their corresponding exectuable. - procs = dict( - [(int(p[0].strip()), self.etime_to_ctime(p[1].strip())) for p in procs] - ) - - return procs - - -class PlatformMac(PlatformPosix): - """ - Concrete implementation of :py:class:~MDANSE.Core.Platform.Platform interface for MacOS OS. - """ - - name = "macos" - - -class PlatformLinux(PlatformPosix): - """ - Concrete implementation of :py:class:~MDANSE.Core.Platform.Platform interface for Linux OS. - """ - - name = "linux" - - -class PlatformWin(Platform): - """ - Concrete implementation of :py:class:~MDANSE.Core.Platform.Platform interface for Windows OS. - """ - - name = "windows" - - def application_directory(self): - """ - Returns the path for MDANSE application directory. - - The directory data used by MDANSE for storing preferences, databses, jobs temporary files ... - - :return: the path for MDANSE application directory. - :rtype: str - """ - - basedir = os.path.join(os.environ["APPDATA"], "mdanse") - - # If the application directory does not exist, create it. - if not os.path.exists(basedir): - os.makedirs(basedir) - - return basedir - - def get_process_creation_time(self, process): - """ - Return the creation time of a given process. - - :param process: the process to check for creation time - :type process: int - - :return: the process creation time from time stamp - :rtype: int - """ - - creationtime = ctypes.c_ulonglong() - exittime = ctypes.c_ulonglong() - kerneltime = ctypes.c_ulonglong() - usertime = ctypes.c_ulonglong() - rc = ctypes.windll.kernel32.GetProcessTimes( - process, - ctypes.byref(creationtime), - ctypes.byref(exittime), - ctypes.byref(kerneltime), - ctypes.byref(usertime), - ) - - creationtime.value -= ctypes.c_longlong(116444736000000000).value - creationtime.value //= 10000000 - - return creationtime.value - - def get_processes_info(self): - """ - Returns the current active processes. - - :return: a mapping between active processes pid and their corresponding process name. - :rtype: dict - - :note: Adapted from Eric Koome's implementation (http://code.activestate.com/recipes/305279-getting-process-information-on-windows/) - """ - - DWORD = ctypes.c_ulong - PROCESS_QUERY_INFORMATION = 0x0400 - PROCESS_VM_READ = 0x0010 - - parr = DWORD * 1024 - aProcesses = parr() - cbNeeded = DWORD(0) - hModule = DWORD() - - processes = {} - - # Call Enumprocesses to get hold of process id's - ctypes.windll.psapi.EnumProcesses( - ctypes.byref(aProcesses), ctypes.sizeof(aProcesses), ctypes.byref(cbNeeded) - ) - - # Number of processes returned - nReturned = cbNeeded.value // ctypes.sizeof(ctypes.c_ulong()) - - pidProcess = [i for i in aProcesses][:nReturned] - - for pid in pidProcess: - # Get handle to the process based on PID - hProcess = ctypes.windll.kernel32.OpenProcess( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, False, pid - ) - - if hProcess: - ctypes.windll.psapi.EnumProcessModules( - hProcess, - ctypes.byref(hModule), - ctypes.sizeof(hModule), - ctypes.byref(cbNeeded), - ) - - try: - creationTime = self.get_process_creation_time(hProcess) - creationTime = datetime.datetime.strftime( - datetime.datetime.fromtimestamp(creationTime), - "%d-%m-%Y %H:%M:%S", - ) - processes[int(pid)] = creationTime - except ValueError: - continue - - ctypes.windll.kernel32.CloseHandle(hProcess) - - return processes - - def home_directory(self): - """ - Returns the home directory of the user that runs MDANSE. - - @return: the home directory - @rtype: str - """ - - return os.environ["USERPROFILE"] - - def kill_process(self, pid): - """ - Kill a specified process. - - :param pid: the pid of the process to be killed. - :type pid: int - """ - - PROCESS_TERMINATE = 1 - - # Get the hadler of the process to be killed. - handle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, False, pid) - - # Terminate the process. - ctypes.windll.kernel32.TerminateProcess(handle, -1) - - # Close the handle. - ctypes.windll.kernel32.CloseHandle(handle) - - -import platform - -system = platform.system() - -# Instantiate the proper platform class depending on the OS on which MDANSE runs -if system == "Linux": - PLATFORM = PlatformLinux() -elif system == "Darwin": - PLATFORM = PlatformMac() -else: - PLATFORM = PlatformWin() -del platform +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import abc +import ctypes +import datetime +import getpass +import inspect +import os +import re +import subprocess + +from MDANSE.Core.Error import Error + + +class PlatformError(Error): + """ + This class handles error related to Platform derived classes. + """ + + pass + + +class Platform(object, metaclass=abc.ABCMeta): + """ + This is the base class for OS-free standard operations. + """ + + __instance = None + + def __new__(cls, *args, **kwargs): + """ + Create a new instance of Platform class. + + :param cls: the class to instanciate. + :type cls: class + """ + + # Case of the first instanciation. + if cls.__instance is None: + cls.__instance = super(Platform, cls).__new__(cls, *args, **kwargs) + + return cls.__instance + + @abc.abstractmethod + def application_directory(self): + """ + Returns the path for MDANSE application directory. + + The directory data used by MDANSE for storing preferences, databses, jobs temporary files ... + + :return: the path for MDANSE application directory. + :rtype: str + """ + pass + + def doc_path(self): + """ + Returns the path for MDANSE documentation root directory. + + :return: the path for MDANSE documentation root directory + :rtype: str + """ + + return os.path.join(self.package_directory(), "Doc") + + def jobs_launch_delay(self): + """ + Returns the delay (in seconds) for a job to launch. + This is used to determine the delay before updating the GUI and suppressing a job status file + + :return: the delay (in seconds) for a job to launch + :rtype: float + """ + return 2.0 + + def api_path(self): + """ + Returns the path for MDANSE HTML API. + + :return: the path for MDANSE HTML documentation + :rtype: str + """ + + return os.path.join(self.package_directory(), "Doc", "api", "html") + + def help_path(self): + """ + Returns the path for MDANSE HTML help. + + :return: the path for MDANSE HTML documentation + :rtype: str + """ + + return os.path.join(self.package_directory(), "Doc", "help", "html") + + def full_dotted_module(self, obj): + """ + Returns the fully dotted name of a module given the module object itself or a class stored in this module. + + :param obj: the module object or a class stored in stored in this module. + :type obj: module or class + + :return: the fully dotted name of the module. + :rtype: str + """ + + if inspect.ismodule(obj): + path = obj.__file__ + elif inspect.isclass(obj): + path = inspect.getmodule(obj).__file__ + else: + raise PlatformError("Invalid query object type.") + + basepath = os.path.join(os.path.dirname(self.package_directory()), "") + + s = path.split(basepath) + if len(s) != 2: + return None + + _, relativePath = path.split(basepath) + + relativePath = os.path.splitext(relativePath)[0] + + return ".".join(relativePath.split(os.path.sep)) + + def change_directory(self, directory): + """ + Change the current directory to a new directory. + + :param directory: the new directory + :type directory: str + """ + + os.chdir(directory) + + def is_directory_writable(self, path): + """ + Check whether a given directory is writable. + + :param path: the directory to be tested for writable status + :type path: str + + :return: true if the directory is writable, false otherwise + :rtype: bool + """ + + # Gets an absolute version of the path to check + path = self.get_path(path) + + return os.access(path, os.W_OK | os.X_OK) + + def create_directory(self, path): + """ + Creates a directory. + + :param path: the path of the directory to create + :type path: str + """ + + path = self.get_path(path) + + if os.path.exists(path): + return + + # Try to make the directory. + try: + os.makedirs(path) + + # An error occured. + except OSError as e: + raise PlatformError( + "The following exception was raised while trying to create a directory at " + "{0}: /n {1}".format(str(path), e) + ) + + def get_path(self, path): + """ + Return a normalized and absolute version of a given path + + :param path: the path of the file to be normalized and made absolute + :type path: str + + :return: the normalized and absolute version of the input path + :rtype: str + """ + + path = str(path).encode("unicode-escape") + + path = os.path.abspath(os.path.expanduser(path)).decode("utf-8") + + return path + + def database_default_path(self): + """ + Returns the path for the default MDANSE elements database. + + :return: the MDANSE default elements database path + :rtype: string + """ + + return os.path.join(self.package_directory(), "Data", "elements_database.csv") + + def database_user_path(self): + """ + Returns the path for user MDANSE elements database. + + :return: the MDANSE user elements database path. + :rtype: string + """ + + return os.path.join(self.application_directory(), "elements_database.csv") + + @abc.abstractmethod + def get_processes_info(self): + """ + Returns the current active processes. + + :return: a mapping between active processes pid and their corresponding process name. + :rtype: dict + """ + pass + + @abc.abstractmethod + def kill_process(self, pid): + """ + Kill a specified process. + + :param pid: the pid of the process to be killed. + :type pid: int + """ + pass + + def pid(self): + """ + Return the pid of the process that currently runs MDANSE. + + :return: the pid of the process running MDANSE + :rtype: int + """ + + return os.getpid() + + def example_data_directory(self): + """ + Returns the path for MDANSE example data (samples of trajectories, McStas files ...). + + :return: the path for MDANSE example files + :rtype: str + """ + + return os.path.join(os.path.dirname(self.package_directory()), "Data") + + def base_directory(self): + """ + Returns the path for MDANSE base directory. + + @return: the path for MDANSE base directory. + @rtype: str + """ + + return os.path.dirname(os.path.dirname(os.path.dirname(__file__))) + + def package_directory(self): + """ + Returns the path for MDANSE package. + + @return: the path for MDANSE package. + @rtype: str + """ + + return os.path.dirname(os.path.dirname(__file__)) + + def macros_directory(self): + """ + Returns the path of the directory where the MDANSE macros will be searched. + + :return: the path of the directory where the MDANSE macros will be searched. + :rtype: str + """ + + macrosDir = os.path.join(self.application_directory(), "macros") + + return macrosDir + + def logfiles_directory(self): + """ + Returns the path of the directory where the MDANSE job logfiles are stored. + + :return: the path of the directory where the MDANSE job logfiles are stored. + :rtype: str + """ + + path = os.path.join(self.application_directory(), "logfiles") + + self.create_directory(path) + + return path + + def temporary_files_directory(self): + """ + Returns the path of the directory where the temporary MDANSE job status files are stored. + + :return: the path of the directory where the temporary MDANSE job status files are stored + :rtype: str + """ + + path = os.path.join(self.application_directory(), "temporary_files") + + self.create_directory(path) + + return path + + def username(self): + """ + Returns the name of the user that run MDANSE. + + @return: the name of the user + @rtype: str + """ + + return getpass.getuser().lower() + + @abc.abstractmethod + def home_directory(self): + """ + Returns the home directory of the user that runs MDANSE. + + @return: the home directory + @rtype: str + """ + pass + + +class PlatformPosix(Platform): + """ + Base class for POSIX derived OS. + """ + + def home_directory(self): + """ + Returns the home directory of the user that runs MDANSE. + + @return: the home directory + @rtype: str + """ + + return os.environ["HOME"] + + def kill_process(self, pid): + """ + Kill a specified process. + + :param pid: the pid of the process to be killed. + :type pid: int + """ + + import signal + + os.kill(pid, signal.SIGTERM) + + def application_directory(self): + """ + Returns the path for MDANSE application directory. + + The directory data used by MDANSE for storing preferences, databses, jobs temporary files ... + + :return: the path for MDANSE application directory. + :rtype: str + """ + + basedir = os.path.join(os.environ["HOME"], ".mdanse") + + # If the application directory does not exist, create it. + if not os.path.exists(basedir): + os.makedirs(basedir) + + return basedir + + def etime_to_ctime(self, etime): + """ + Converts the elapsed time (i.e. as output by ps unix command) to local time. + + :param etime: the elapsed time + :type etime: str + + :return: the local time + :rtype: str + """ + + etime = [0, 0, 0] + [int(v) for v in re.split("-|:", etime)] + + days, hours, minutes, seconds = etime[-4:] + + etime = datetime.timedelta( + days=days, hours=hours, minutes=minutes, seconds=seconds + ) + + return (datetime.datetime.today() - etime).strftime("%d-%m-%Y %H:%M:%S") + + def get_processes_info(self): + """ + Returns the current active processes. + + :return: a mapping between active processes pid and their corresponding process name. + :rtype: dict + """ + + # Get all the active processes using the Unix ps command + procs = subprocess.Popen(["ps", "-eo", "pid,etime"], stdout=subprocess.PIPE) + + # The output of the ps command is splitted according to line feeds. + procs = procs.communicate()[0].decode("utf-8").split("\n")[1:] + + # The list of (pid,executable). + procs = [p.split() for p in procs if p] + + # A mapping between the active processes pid and their corresponding exectuable. + procs = dict( + [(int(p[0].strip()), self.etime_to_ctime(p[1].strip())) for p in procs] + ) + + return procs + + +class PlatformMac(PlatformPosix): + """ + Concrete implementation of :py:class:~MDANSE.Core.Platform.Platform interface for MacOS OS. + """ + + name = "macos" + + +class PlatformLinux(PlatformPosix): + """ + Concrete implementation of :py:class:~MDANSE.Core.Platform.Platform interface for Linux OS. + """ + + name = "linux" + + +class PlatformWin(Platform): + """ + Concrete implementation of :py:class:~MDANSE.Core.Platform.Platform interface for Windows OS. + """ + + name = "windows" + + def application_directory(self): + """ + Returns the path for MDANSE application directory. + + The directory data used by MDANSE for storing preferences, databses, jobs temporary files ... + + :return: the path for MDANSE application directory. + :rtype: str + """ + + basedir = os.path.join(os.environ["APPDATA"], "mdanse") + + # If the application directory does not exist, create it. + if not os.path.exists(basedir): + os.makedirs(basedir) + + return basedir + + def get_process_creation_time(self, process): + """ + Return the creation time of a given process. + + :param process: the process to check for creation time + :type process: int + + :return: the process creation time from time stamp + :rtype: int + """ + + creationtime = ctypes.c_ulonglong() + exittime = ctypes.c_ulonglong() + kerneltime = ctypes.c_ulonglong() + usertime = ctypes.c_ulonglong() + rc = ctypes.windll.kernel32.GetProcessTimes( + process, + ctypes.byref(creationtime), + ctypes.byref(exittime), + ctypes.byref(kerneltime), + ctypes.byref(usertime), + ) + + creationtime.value -= ctypes.c_longlong(116444736000000000).value + creationtime.value //= 10000000 + + return creationtime.value + + def get_processes_info(self): + """ + Returns the current active processes. + + :return: a mapping between active processes pid and their corresponding process name. + :rtype: dict + + :note: Adapted from Eric Koome's implementation (http://code.activestate.com/recipes/305279-getting-process-information-on-windows/) + """ + + DWORD = ctypes.c_ulong + PROCESS_QUERY_INFORMATION = 0x0400 + PROCESS_VM_READ = 0x0010 + + parr = DWORD * 1024 + aProcesses = parr() + cbNeeded = DWORD(0) + hModule = DWORD() + + processes = {} + + # Call Enumprocesses to get hold of process id's + ctypes.windll.psapi.EnumProcesses( + ctypes.byref(aProcesses), ctypes.sizeof(aProcesses), ctypes.byref(cbNeeded) + ) + + # Number of processes returned + nReturned = cbNeeded.value // ctypes.sizeof(ctypes.c_ulong()) + + pidProcess = [i for i in aProcesses][:nReturned] + + for pid in pidProcess: + # Get handle to the process based on PID + hProcess = ctypes.windll.kernel32.OpenProcess( + PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, False, pid + ) + + if hProcess: + ctypes.windll.psapi.EnumProcessModules( + hProcess, + ctypes.byref(hModule), + ctypes.sizeof(hModule), + ctypes.byref(cbNeeded), + ) + + try: + creationTime = self.get_process_creation_time(hProcess) + creationTime = datetime.datetime.strftime( + datetime.datetime.fromtimestamp(creationTime), + "%d-%m-%Y %H:%M:%S", + ) + processes[int(pid)] = creationTime + except ValueError: + continue + + ctypes.windll.kernel32.CloseHandle(hProcess) + + return processes + + def home_directory(self): + """ + Returns the home directory of the user that runs MDANSE. + + @return: the home directory + @rtype: str + """ + + return os.environ["USERPROFILE"] + + def kill_process(self, pid): + """ + Kill a specified process. + + :param pid: the pid of the process to be killed. + :type pid: int + """ + + PROCESS_TERMINATE = 1 + + # Get the hadler of the process to be killed. + handle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, False, pid) + + # Terminate the process. + ctypes.windll.kernel32.TerminateProcess(handle, -1) + + # Close the handle. + ctypes.windll.kernel32.CloseHandle(handle) + + +import platform + +system = platform.system() + +# Instantiate the proper platform class depending on the OS on which MDANSE runs +if system == "Linux": + PLATFORM = PlatformLinux() +elif system == "Darwin": + PLATFORM = PlatformMac() +else: + PLATFORM = PlatformWin() +del platform diff --git a/MDANSE/Src/MDANSE/Core/Singleton.py b/MDANSE/Src/MDANSE/Core/Singleton.py index 7eb090305f..e58ff8abe2 100644 --- a/MDANSE/Src/MDANSE/Core/Singleton.py +++ b/MDANSE/Src/MDANSE/Core/Singleton.py @@ -1,34 +1,38 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Core/Singleton.py -# @brief Implements module/class/test Singleton -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -class Singleton(type): - """ - Metaclass that implements the singleton pattern. - """ - - __instances = {} - - def __call__(self, *args, **kwargs): - """ - Creates (or returns if it has already been instanciated) an instance of the class. - """ - - if self.__name__ not in self.__instances: - self.__instances[self.__name__] = super(Singleton, self).__call__( - *args, **kwargs - ) - - return self.__instances[self.__name__] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +class Singleton(type): + """ + Metaclass that implements the singleton pattern. + """ + + __instances = {} + + def __call__(self, *args, **kwargs): + """ + Creates (or returns if it has already been instanciated) an instance of the class. + """ + + if self.__name__ not in self.__instances: + self.__instances[self.__name__] = super(Singleton, self).__call__( + *args, **kwargs + ) + + return self.__instances[self.__name__] diff --git a/MDANSE/Src/MDANSE/Core/SubclassFactory.py b/MDANSE/Src/MDANSE/Core/SubclassFactory.py index d602818116..098af14d43 100644 --- a/MDANSE/Src/MDANSE/Core/SubclassFactory.py +++ b/MDANSE/Src/MDANSE/Core/SubclassFactory.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Core/SubclassFactory.py -# @brief Metaclass creating classes with subclass registry +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from typing import TypeVar import difflib diff --git a/MDANSE/Src/MDANSE/Core/__init__.py b/MDANSE/Src/MDANSE/Core/__init__.py index 1ae8352555..7b93366a0f 100644 --- a/MDANSE/Src/MDANSE/Core/__init__.py +++ b/MDANSE/Src/MDANSE/Core/__init__.py @@ -1,14 +1,18 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Core/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/Extensions/__init__.py b/MDANSE/Src/MDANSE/Extensions/__init__.py index cdbec43a52..7b93366a0f 100644 --- a/MDANSE/Src/MDANSE/Extensions/__init__.py +++ b/MDANSE/Src/MDANSE/Extensions/__init__.py @@ -1,14 +1,18 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Extensions/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/Framework/AtomMapping/__init__.py b/MDANSE/Src/MDANSE/Framework/AtomMapping/__init__.py index ea656f3b73..cb1800cf55 100644 --- a/MDANSE/Src/MDANSE/Framework/AtomMapping/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/AtomMapping/__init__.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from .atom_mapping import guess_element from .atom_mapping import get_element_from_mapping from .atom_mapping import fill_remaining_labels diff --git a/MDANSE/Src/MDANSE/Framework/AtomMapping/atom_mapping.py b/MDANSE/Src/MDANSE/Framework/AtomMapping/atom_mapping.py index c879cae865..f64878f5fe 100644 --- a/MDANSE/Src/MDANSE/Framework/AtomMapping/atom_mapping.py +++ b/MDANSE/Src/MDANSE/Framework/AtomMapping/atom_mapping.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from typing import Union import re import numpy as np @@ -57,8 +72,6 @@ def guess_element(atm_label: str, mass: Union[float, int, None] = None) -> str: if len(guess) == 2: guesses.append(guess[0]) - # using the guess match to the atom and then match to the mass - # if available best_match = None best_diff = np.inf for guess in guesses: diff --git a/MDANSE/Src/MDANSE/Framework/AtomSelector/__init__.py b/MDANSE/Src/MDANSE/Framework/AtomSelector/__init__.py index 2ec00eb8dc..1ce9f3c792 100644 --- a/MDANSE/Src/MDANSE/Framework/AtomSelector/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/AtomSelector/__init__.py @@ -1 +1,16 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from .selector import Selector diff --git a/MDANSE/Src/MDANSE/Framework/AtomSelector/all_selector.py b/MDANSE/Src/MDANSE/Framework/AtomSelector/all_selector.py index 9dc283672b..46e327b071 100644 --- a/MDANSE/Src/MDANSE/Framework/AtomSelector/all_selector.py +++ b/MDANSE/Src/MDANSE/Framework/AtomSelector/all_selector.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from typing import Union from MDANSE.Chemistry.ChemicalEntity import ChemicalSystem diff --git a/MDANSE/Src/MDANSE/Framework/AtomSelector/atom_selectors.py b/MDANSE/Src/MDANSE/Framework/AtomSelector/atom_selectors.py index ad511d6633..1437c5ef02 100644 --- a/MDANSE/Src/MDANSE/Framework/AtomSelector/atom_selectors.py +++ b/MDANSE/Src/MDANSE/Framework/AtomSelector/atom_selectors.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from typing import Union from MDANSE.Chemistry.ChemicalEntity import ChemicalSystem from MDANSE.Chemistry import ATOMS_DATABASE diff --git a/MDANSE/Src/MDANSE/Framework/AtomSelector/group_selectors.py b/MDANSE/Src/MDANSE/Framework/AtomSelector/group_selectors.py index decb247f1f..dfddde02a2 100644 --- a/MDANSE/Src/MDANSE/Framework/AtomSelector/group_selectors.py +++ b/MDANSE/Src/MDANSE/Framework/AtomSelector/group_selectors.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from typing import Union from MDANSE.Chemistry.ChemicalEntity import ChemicalSystem @@ -53,7 +68,6 @@ def select_hydroxy( Union[set[int], bool] The atom indices of the matched atoms or a bool if checking match. """ - # including -OH on water pattern = "[#8;H1,H2]~[H]" if check_exists: return system.has_substructure_match(pattern) diff --git a/MDANSE/Src/MDANSE/Framework/AtomSelector/molecule_selectors.py b/MDANSE/Src/MDANSE/Framework/AtomSelector/molecule_selectors.py index 53c63ade64..eeab32e155 100644 --- a/MDANSE/Src/MDANSE/Framework/AtomSelector/molecule_selectors.py +++ b/MDANSE/Src/MDANSE/Framework/AtomSelector/molecule_selectors.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from typing import Union from MDANSE.Chemistry.ChemicalEntity import ChemicalSystem diff --git a/MDANSE/Src/MDANSE/Framework/AtomSelector/selector.py b/MDANSE/Src/MDANSE/Framework/AtomSelector/selector.py index 3b888f23f3..153c6d916c 100644 --- a/MDANSE/Src/MDANSE/Framework/AtomSelector/selector.py +++ b/MDANSE/Src/MDANSE/Framework/AtomSelector/selector.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# import json import copy from typing import Union @@ -22,7 +37,6 @@ class Selector: """ _default = { - # True selects atoms "all": True, "dummy": False, "hs_on_heteroatom": False, diff --git a/MDANSE/Src/MDANSE/Framework/Configurable.py b/MDANSE/Src/MDANSE/Framework/Configurable.py index e771ca5126..15ea36b13d 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurable.py +++ b/MDANSE/Src/MDANSE/Framework/Configurable.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Configurable.py -# @brief Implements module/class/test Configurable +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py index 2971ea0000..06c86141d4 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Configurators/InputFileConfigurator.py -# @brief Implements module/class/test InputFileConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from ase.io import iread, read from ase.io.trajectory import Trajectory as ASETrajectory diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py index 11a99bac23..26d16e1e57 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Configurators/InputFileConfigurator.py -# @brief Implements module/class/test InputFileConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py index 427965cdcb..1a54ba7a35 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Configurators/AtomMappingConfigurator.py -# @brief Implements module/class/test AtomMappingConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import json from MDANSE.Framework.AtomMapping import fill_remaining_labels, check_mapping_valid diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py index 8f64c25c51..bfc0e148a1 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py @@ -1,134 +1,138 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/AtomSelectionConfigurator.py -# @brief Implements module/class/test AtomSelectionConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -import operator -from MDANSE.Chemistry import ATOMS_DATABASE -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) -from MDANSE.Framework.AtomSelector import Selector - - -class AtomSelectionConfigurator(IConfigurator): - """ - This configurator allows the selection of a specific set of atoms on which the analysis will be performed. - - Without any selection, all the atoms stored into the trajectory file will be selected. - - After the call to :py:meth:`~MDANSE.Framework.Configurators.AtomSelectionConfigurator.AtomSelectionConfigurator.configure` method - the following keys will be available for this configurator - - #. value: the input value used to configure this configurator - #. indexes: the sorted (in increasing order) indexes of the selected atoms - #. n_selected_atoms: the number of selected atoms - #. elements: a nested-list of the chemical symbols of the selected atoms. The size of the nested list depends on the grouping_level selected via :py:class:`~MDANSE.Framework.Configurators.GroupingLevelConfigurator.GroupingLevelConfigurator` configurator. - - :note: this configurator depends on :py:class:`~MDANSE.Framework.Configurators.HDFTrajectoryConfigurator.HDFTrajectoryConfigurator` and :py:class:`~MDANSE.Framework.Configurators.GroupingLevelConfigurator.GroupingLevelConfigurator` configurators to be configured - """ - - _default = '{"all": true}' - - def configure(self, value): - """ - Configure an input value. - - The value must be a string that can be either an atom selection string or a valid user definition. - - :param value: the input value - :type value: str - """ - - trajConfig = self._configurable[self._dependencies["trajectory"]] - - if value is None: - value = self._default - - if not isinstance(value, str): - self.error_status = "Invalid input value." - return - - selector = Selector(trajConfig["instance"].chemical_system) - if not selector.check_valid_json_settings(value): - self.error_status = "Invalid JSON string." - return - - self["value"] = value - - selector.update_from_json(value) - indexes = selector.get_idxs() - - self["flatten_indexes"] = sorted(list(indexes)) - - trajConfig = self._configurable[self._dependencies["trajectory"]] - - atoms = sorted( - trajConfig["instance"].chemical_system.atom_list, - key=operator.attrgetter("index"), - ) - selectedAtoms = [atoms[idx] for idx in self["flatten_indexes"]] - - self["selection_length"] = len(self["flatten_indexes"]) - self["indexes"] = [[idx] for idx in self["flatten_indexes"]] - - self["elements"] = [[at.symbol] for at in selectedAtoms] - self["names"] = [at.symbol for at in selectedAtoms] - self["unique_names"] = sorted(set(self["names"])) - self["masses"] = [ - [ATOMS_DATABASE.get_atom_property(n, "atomic_weight")] - for n in self["names"] - ] - self.error_status = "OK" - - def get_natoms(self): - nAtomsPerElement = {} - for v in self["names"]: - if v in nAtomsPerElement: - nAtomsPerElement[v] += 1 - else: - nAtomsPerElement[v] = 1 - - return nAtomsPerElement - - def get_indexes(self): - indexesPerElement = {} - for i, v in enumerate(self["names"]): - if v in indexesPerElement: - indexesPerElement[v].extend(self["indexes"][i]) - else: - indexesPerElement[v] = self["indexes"][i][:] - - return indexesPerElement - - def get_information(self): - """ - Returns some informations the atom selection. - - :return: the information about the atom selection. - :rtype: str - """ - - if "selection_length" not in self: - return "Not configured yet\n" - - info = [] - info.append("Number of selected atoms:%d" % self["selection_length"]) - info.append("Selected elements:%s" % self["unique_names"]) - - return "\n".join(info) + "\n" - - def get_selector(self) -> Selector: - traj_config = self._configurable[self._dependencies["trajectory"]] - selector = Selector(traj_config["instance"].chemical_system) - return selector +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +import operator +from MDANSE.Chemistry import ATOMS_DATABASE +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) +from MDANSE.Framework.AtomSelector import Selector + + +class AtomSelectionConfigurator(IConfigurator): + """ + This configurator allows the selection of a specific set of atoms on which the analysis will be performed. + + Without any selection, all the atoms stored into the trajectory file will be selected. + + After the call to :py:meth:`~MDANSE.Framework.Configurators.AtomSelectionConfigurator.AtomSelectionConfigurator.configure` method + the following keys will be available for this configurator + + #. value: the input value used to configure this configurator + #. indexes: the sorted (in increasing order) indexes of the selected atoms + #. n_selected_atoms: the number of selected atoms + #. elements: a nested-list of the chemical symbols of the selected atoms. The size of the nested list depends on the grouping_level selected via :py:class:`~MDANSE.Framework.Configurators.GroupingLevelConfigurator.GroupingLevelConfigurator` configurator. + + :note: this configurator depends on :py:class:`~MDANSE.Framework.Configurators.HDFTrajectoryConfigurator.HDFTrajectoryConfigurator` and :py:class:`~MDANSE.Framework.Configurators.GroupingLevelConfigurator.GroupingLevelConfigurator` configurators to be configured + """ + + _default = '{"all": true}' + + def configure(self, value): + """ + Configure an input value. + + The value must be a string that can be either an atom selection string or a valid user definition. + + :param value: the input value + :type value: str + """ + + trajConfig = self._configurable[self._dependencies["trajectory"]] + + if value is None: + value = self._default + + if not isinstance(value, str): + self.error_status = "Invalid input value." + return + + selector = Selector(trajConfig["instance"].chemical_system) + if not selector.check_valid_json_settings(value): + self.error_status = "Invalid JSON string." + return + + self["value"] = value + + selector.update_from_json(value) + indexes = selector.get_idxs() + + self["flatten_indexes"] = sorted(list(indexes)) + + trajConfig = self._configurable[self._dependencies["trajectory"]] + + atoms = sorted( + trajConfig["instance"].chemical_system.atom_list, + key=operator.attrgetter("index"), + ) + selectedAtoms = [atoms[idx] for idx in self["flatten_indexes"]] + + self["selection_length"] = len(self["flatten_indexes"]) + self["indexes"] = [[idx] for idx in self["flatten_indexes"]] + + self["elements"] = [[at.symbol] for at in selectedAtoms] + self["names"] = [at.symbol for at in selectedAtoms] + self["unique_names"] = sorted(set(self["names"])) + self["masses"] = [ + [ATOMS_DATABASE.get_atom_property(n, "atomic_weight")] + for n in self["names"] + ] + self.error_status = "OK" + + def get_natoms(self): + nAtomsPerElement = {} + for v in self["names"]: + if v in nAtomsPerElement: + nAtomsPerElement[v] += 1 + else: + nAtomsPerElement[v] = 1 + + return nAtomsPerElement + + def get_indexes(self): + indexesPerElement = {} + for i, v in enumerate(self["names"]): + if v in indexesPerElement: + indexesPerElement[v].extend(self["indexes"][i]) + else: + indexesPerElement[v] = self["indexes"][i][:] + + return indexesPerElement + + def get_information(self): + """ + Returns some informations the atom selection. + + :return: the information about the atom selection. + :rtype: str + """ + + if "selection_length" not in self: + return "Not configured yet\n" + + info = [] + info.append("Number of selected atoms:%d" % self["selection_length"]) + info.append("Selected elements:%s" % self["unique_names"]) + + return "\n".join(info) + "\n" + + def get_selector(self) -> Selector: + traj_config = self._configurable[self._dependencies["trajectory"]] + selector = Selector(traj_config["instance"].chemical_system) + return selector diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py index 9474f215fe..5e9c77f6f1 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py @@ -1,142 +1,146 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/AtomTransmutationConfigurator.py -# @brief Implements module/class/test AtomTransmutationConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Chemistry import ATOMS_DATABASE -from MDANSE.Framework.UserDefinitionStore import UD_STORE -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) -from MDANSE.Framework.AtomSelector import Selector - - -class AtomTransmutationConfigurator(IConfigurator): - """ - This configurator allows to define a set of atoms to be transmutated to a given chemical - element. - - For some analysis it can be necessary to change the nature of the chemical element of a given - part of the system to have results closer to experience. A good example is to change some - hydrogen atoms to deuterium in order to fit with experiments where deuteration experiments have - been performed for improving the contrast and having a better access to the dynamic of a specific part - of the molecular system. - - :note: this configurator depends on 'trajectory' and 'atom_selection' configurators to be configured - """ - - _default = None - - def configure(self, value): - """ - Configure an input value. - - The value can be: - - #. ``None``: no transmutation is performed - #. (str,str)-dict: for each (str,str) pair, a transmutation will be performed by parsing \ - the 1st element as an atom selection string and transmutating the corresponding atom \ - selection to the target chemical element stored in the 2nd element - #. str: the transmutation will be performed by reading the corresponding user definition - - :param value: the input value - :type value: None or (str,str)-dict or str - """ - - self["value"] = value - - # if the input value is None, do not perform any transmutation - if value is None: - return - - if not isinstance(value, (list, tuple)): - self.error_status = "Invalid input value." - return - - trajConfig = self._configurable[self._dependencies["trajectory"]] - - self._nTransmutatedAtoms = 0 - - selector = Selector(trajConfig["instance"].chemical_system) - for json_string, element in value: - # Otherwise, it must be a string that will be found as a user-definition keys - if not isinstance(json_string, str): - self.error_status = "Wrong format for atom transmutation configurator." - return - - if UD_STORE.has_definition( - trajConfig["basename"], "atom_selection", json_string - ): - ud = UD_STORE.get_definition( - trajConfig["basename"], "atom_selection", json_string - ) - indexes = ud["indexes"] - else: - selector.update_from_json(json_string, reset_first=True) - indexes = selector.get_idxs() - - self.transmutate(indexes, element) - - self._nTransmutatedAtoms += len(indexes) - - def transmutate(self, selection, element): - """ - Transmutates a set of atoms to a given element - - :param selection: the indexes of the atoms to be transmutated - :type selection: list of int - :param element: the symbol of the element to which the selected atoms should be transmutated - :type element: str - """ - - if element not in ATOMS_DATABASE: - self.error_status = ( - f"the element {element} is not registered in the database" - ) - return - - atomSelConfigurator = self._configurable[self._dependencies["atom_selection"]] - - for idx in selection: - try: - idxInSelection = atomSelConfigurator["flatten_indexes"].index(idx) - except ValueError: - pass - else: - atomSelConfigurator["names"][idxInSelection] = element - atomSelConfigurator["elements"][idxInSelection] = [element] - - atomSelConfigurator["unique_names"] = sorted(set(atomSelConfigurator["names"])) - atomSelConfigurator["masses"] = [ - [ATOMS_DATABASE.get_atom_property(n, "atomic_weight")] - for n in atomSelConfigurator["names"] - ] - self.error_status = "OK" - - def get_information(self): - """ - Returns some informations the atoms selected for being transmutated. - - :return: the information about the atoms selected for being transmutated. - :rtype: str - """ - - if "value" not in self: - return "Not configured yet" - - if self["value"] is None: - return "No atoms selected for transmutation\n" - - return "Number of transmutated atoms:%d\n" % self._nTransmutatedAtoms +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Chemistry import ATOMS_DATABASE +from MDANSE.Framework.UserDefinitionStore import UD_STORE +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) +from MDANSE.Framework.AtomSelector import Selector + + +class AtomTransmutationConfigurator(IConfigurator): + """ + This configurator allows to define a set of atoms to be transmutated to a given chemical + element. + + For some analysis it can be necessary to change the nature of the chemical element of a given + part of the system to have results closer to experience. A good example is to change some + hydrogen atoms to deuterium in order to fit with experiments where deuteration experiments have + been performed for improving the contrast and having a better access to the dynamic of a specific part + of the molecular system. + + :note: this configurator depends on 'trajectory' and 'atom_selection' configurators to be configured + """ + + _default = None + + def configure(self, value): + """ + Configure an input value. + + The value can be: + + #. ``None``: no transmutation is performed + #. (str,str)-dict: for each (str,str) pair, a transmutation will be performed by parsing \ + the 1st element as an atom selection string and transmutating the corresponding atom \ + selection to the target chemical element stored in the 2nd element + #. str: the transmutation will be performed by reading the corresponding user definition + + :param value: the input value + :type value: None or (str,str)-dict or str + """ + + self["value"] = value + + # if the input value is None, do not perform any transmutation + if value is None: + return + + if not isinstance(value, (list, tuple)): + self.error_status = "Invalid input value." + return + + trajConfig = self._configurable[self._dependencies["trajectory"]] + + self._nTransmutatedAtoms = 0 + + selector = Selector(trajConfig["instance"].chemical_system) + for json_string, element in value: + # Otherwise, it must be a string that will be found as a user-definition keys + if not isinstance(json_string, str): + self.error_status = "Wrong format for atom transmutation configurator." + return + + if UD_STORE.has_definition( + trajConfig["basename"], "atom_selection", json_string + ): + ud = UD_STORE.get_definition( + trajConfig["basename"], "atom_selection", json_string + ) + indexes = ud["indexes"] + else: + selector.update_from_json(json_string, reset_first=True) + indexes = selector.get_idxs() + + self.transmutate(indexes, element) + + self._nTransmutatedAtoms += len(indexes) + + def transmutate(self, selection, element): + """ + Transmutates a set of atoms to a given element + + :param selection: the indexes of the atoms to be transmutated + :type selection: list of int + :param element: the symbol of the element to which the selected atoms should be transmutated + :type element: str + """ + + if element not in ATOMS_DATABASE: + self.error_status = ( + f"the element {element} is not registered in the database" + ) + return + + atomSelConfigurator = self._configurable[self._dependencies["atom_selection"]] + + for idx in selection: + try: + idxInSelection = atomSelConfigurator["flatten_indexes"].index(idx) + except ValueError: + pass + else: + atomSelConfigurator["names"][idxInSelection] = element + atomSelConfigurator["elements"][idxInSelection] = [element] + + atomSelConfigurator["unique_names"] = sorted(set(atomSelConfigurator["names"])) + atomSelConfigurator["masses"] = [ + [ATOMS_DATABASE.get_atom_property(n, "atomic_weight")] + for n in atomSelConfigurator["names"] + ] + self.error_status = "OK" + + def get_information(self): + """ + Returns some informations the atoms selected for being transmutated. + + :return: the information about the atoms selected for being transmutated. + :rtype: str + """ + + if "value" not in self: + return "Not configured yet" + + if self["value"] is None: + return "No atoms selected for transmutation\n" + + return "Number of transmutated atoms:%d\n" % self._nTransmutatedAtoms diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py index ab2469a7f5..644fc9cc1c 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py @@ -1,117 +1,121 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/AtomsListConfigurator.py -# @brief Implements module/class/test AtomsListConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.UserDefinitionStore import UD_STORE -from MDANSE.Framework.Configurators.IConfigurator import IConfigurator -from MDANSE.MolecularDynamics.TrajectoryUtils import find_atoms_in_molecule - - -class AtomsListConfigurator(IConfigurator): - """ - This configurator allows of a given list of atom names. - - The atoms has to belong to the same molecule. - - :note: this configurator depends on 'trajectory' - """ - - _default = None - - def __init__(self, name, nAtoms=2, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param nAtoms: the (exact) number of atoms of the list. - :type nAtoms: int - """ - - IConfigurator.__init__(self, name, **kwargs) - - self._nAtoms = nAtoms - - @property - def nAtoms(self): - return self._nAtoms - - def configure(self, value): - """ - Configure an input value. - - The value must be a string that can be either an atom selection string or a valid user - definition. - - :param value: the input value - :type value: str - """ - - traj_configurator = self._configurable[self._dependencies["trajectory"]] - - if UD_STORE.has_definition( - traj_configurator["basename"], "%d_atoms_list" % self._nAtoms, value - ): - molecule, atoms = UD_STORE.get_definition( - traj_configurator["basename"], "%d_atoms_list" % self._nAtoms, value - ) - elif UD_STORE.has_definition( - traj_configurator["basename"], "AtomsListConfigurator", value - ): - tempdict = UD_STORE.get_definition( - traj_configurator["basename"], "AtomsListConfigurator", value - ) - natoms = tempdict["natoms"] - if not natoms == self._nAtoms: - raise ValueError( - "The atom list must have " - + str(self._nAtoms) - + " atoms per molecule, but " - + str(natoms) - + " were found." - ) - atoms = tempdict["indexes"] - self["value"] = value - self["atoms"] = atoms - self["n_values"] = len(self["atoms"]) - return None # this new section should be self-sufficient. - else: - molecule, atoms = value - - self["value"] = value - - self["atoms"] = find_atoms_in_molecule( - traj_configurator["instance"].chemical_system, molecule, atoms, True - ) - - self["n_values"] = len(self["atoms"]) - - def get_information(self): - """ - Returns some informations the atom selection. - - :return: the information about the atom selection. - :rtype: str - """ - - if "atoms" not in self: - return "No configured yet" - - info = [] - info.append( - "Number of selected %d-tuplets:%d" % (self._nAtoms, self["n_values"]) - ) - - return "\n".join(info) + "\n" +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.UserDefinitionStore import UD_STORE +from MDANSE.Framework.Configurators.IConfigurator import IConfigurator +from MDANSE.MolecularDynamics.TrajectoryUtils import find_atoms_in_molecule + + +class AtomsListConfigurator(IConfigurator): + """ + This configurator allows of a given list of atom names. + + The atoms has to belong to the same molecule. + + :note: this configurator depends on 'trajectory' + """ + + _default = None + + def __init__(self, name, nAtoms=2, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param nAtoms: the (exact) number of atoms of the list. + :type nAtoms: int + """ + + IConfigurator.__init__(self, name, **kwargs) + + self._nAtoms = nAtoms + + @property + def nAtoms(self): + return self._nAtoms + + def configure(self, value): + """ + Configure an input value. + + The value must be a string that can be either an atom selection string or a valid user + definition. + + :param value: the input value + :type value: str + """ + + traj_configurator = self._configurable[self._dependencies["trajectory"]] + + if UD_STORE.has_definition( + traj_configurator["basename"], "%d_atoms_list" % self._nAtoms, value + ): + molecule, atoms = UD_STORE.get_definition( + traj_configurator["basename"], "%d_atoms_list" % self._nAtoms, value + ) + elif UD_STORE.has_definition( + traj_configurator["basename"], "AtomsListConfigurator", value + ): + tempdict = UD_STORE.get_definition( + traj_configurator["basename"], "AtomsListConfigurator", value + ) + natoms = tempdict["natoms"] + if not natoms == self._nAtoms: + raise ValueError( + "The atom list must have " + + str(self._nAtoms) + + " atoms per molecule, but " + + str(natoms) + + " were found." + ) + atoms = tempdict["indexes"] + self["value"] = value + self["atoms"] = atoms + self["n_values"] = len(self["atoms"]) + return None # this new section should be self-sufficient. + else: + molecule, atoms = value + + self["value"] = value + + self["atoms"] = find_atoms_in_molecule( + traj_configurator["instance"].chemical_system, molecule, atoms, True + ) + + self["n_values"] = len(self["atoms"]) + + def get_information(self): + """ + Returns some informations the atom selection. + + :return: the information about the atom selection. + :rtype: str + """ + + if "atoms" not in self: + return "No configured yet" + + info = [] + info.append( + "Number of selected %d-tuplets:%d" % (self._nAtoms, self["n_values"]) + ) + + return "\n".join(info) + "\n" diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py index cef9584902..acf4bd2aa1 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py @@ -1,87 +1,91 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/AxisSelectionConfigurator.py -# @brief Implements module/class/test AxisSelectionConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.UserDefinitionStore import UD_STORE -from MDANSE.Framework.Configurators.IConfigurator import IConfigurator -from MDANSE.MolecularDynamics.TrajectoryUtils import find_atoms_in_molecule - - -class AxisSelectionConfigurator(IConfigurator): - """ - This configurator allows to define a local axis per molecule. - - For each molecule, the axis is defined using the coordinates of two atoms of the molecule. - - :note: this configurator depends on 'trajectory' configurator to be configured. - """ - - _default = None - - def configure(self, value): - """ - Configure an input value. - - The value can be: - - #. a dict with *'molecule'*, *'endpoint1'* and *'endpoint2'* keys. *'molecule'* key \ - is the name of the molecule for which the axis selection will be performed and *'endpoint1'* \ - and *'endpoint2'* keys are the names of two atoms of the molecule along which the axis will be defined - #. str: the axis selection will be performed by reading the corresponding user definition. - - :param configuration: the current configuration - :type configuration: MDANSE.Framework.Configurable.Configurable - :param value: the input value - :type value: tuple or str - """ - - trajConfig = self._configurable[self._dependencies["trajectory"]] - - if UD_STORE.has_definition(trajConfig["basename"], "axis_selection", value): - ud = UD_STORE.get_definition( - trajConfig["basename"], "axis_selection", value - ) - self.update(ud) - else: - self.update(value) - - e1 = find_atoms_in_molecule( - trajConfig["instance"]._chemical_system, - self["molecule"], - self["endpoint1"], - True, - ) - e2 = find_atoms_in_molecule( - trajConfig["instance"]._chemical_system, - self["molecule"], - self["endpoint2"], - True, - ) - - self["value"] = value - - self["endpoints"] = list(zip(e1, e2)) - - self["n_axis"] = len(self["endpoints"]) - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "Axis vector:%s\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.UserDefinitionStore import UD_STORE +from MDANSE.Framework.Configurators.IConfigurator import IConfigurator +from MDANSE.MolecularDynamics.TrajectoryUtils import find_atoms_in_molecule + + +class AxisSelectionConfigurator(IConfigurator): + """ + This configurator allows to define a local axis per molecule. + + For each molecule, the axis is defined using the coordinates of two atoms of the molecule. + + :note: this configurator depends on 'trajectory' configurator to be configured. + """ + + _default = None + + def configure(self, value): + """ + Configure an input value. + + The value can be: + + #. a dict with *'molecule'*, *'endpoint1'* and *'endpoint2'* keys. *'molecule'* key \ + is the name of the molecule for which the axis selection will be performed and *'endpoint1'* \ + and *'endpoint2'* keys are the names of two atoms of the molecule along which the axis will be defined + #. str: the axis selection will be performed by reading the corresponding user definition. + + :param configuration: the current configuration + :type configuration: MDANSE.Framework.Configurable.Configurable + :param value: the input value + :type value: tuple or str + """ + + trajConfig = self._configurable[self._dependencies["trajectory"]] + + if UD_STORE.has_definition(trajConfig["basename"], "axis_selection", value): + ud = UD_STORE.get_definition( + trajConfig["basename"], "axis_selection", value + ) + self.update(ud) + else: + self.update(value) + + e1 = find_atoms_in_molecule( + trajConfig["instance"]._chemical_system, + self["molecule"], + self["endpoint1"], + True, + ) + e2 = find_atoms_in_molecule( + trajConfig["instance"]._chemical_system, + self["molecule"], + self["endpoint2"], + True, + ) + + self["value"] = value + + self["endpoints"] = list(zip(e1, e2)) + + self["n_axis"] = len(self["endpoints"]) + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "Axis vector:%s\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py index e8306c50da..3bd00e132f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py @@ -1,84 +1,88 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/BasisSelectionConfigurator.py -# @brief Implements module/class/test BasisSelectionConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.UserDefinitionStore import UD_STORE -from MDANSE.Framework.Configurators.IConfigurator import IConfigurator -from MDANSE.MolecularDynamics.TrajectoryUtils import find_atoms_in_molecule - - -class BasisSelectionConfigurator(IConfigurator): - """ - This configurator allows to define a local basis per molecule. - - For each molecule, the basis is defined using the coordinates of three atoms of the molecule. - These coordinates will respectively define the origin, the X axis and y axis of the basis, the - Z axis being latter defined in such a way that the basis is direct. - """ - - _default = None - - def configure(self, value): - """ - Configure an input value. - - The value can be: - - #. a dict with *'molecule'*, *'origin'*, *'x_axis'* and *'y_axis'* keys. *'molecule'* key is \ - the name of the molecule for which the axis selection will be performed and *'origin'*, *'x_axis'* and *'y_axis'* \ - keys are the names of three atoms of the molecule that will be used to define respectively the origin, the X and Y axis of the basis - #. str: the axis selection will be performed by reading the corresponding user definition. - - :param value: the input value - :type value: tuple or str - - :note: this configurator depends on 'trajectory' configurator to be configured - """ - - trajConfig = self._configurable[self._dependencies["trajectory"]] - - if UD_STORE.has_definition(trajConfig["basename"], "basis_selection", value): - ud = UD_STORE.get_definition( - trajConfig["basename"], "basis_selection", value - ) - self.update(ud) - else: - self.update(value) - - e1 = find_atoms_in_molecule( - trajConfig["instance"].universe, self["molecule"], self["origin"], True - ) - e2 = find_atoms_in_molecule( - trajConfig["instance"].universe, self["molecule"], self["x_axis"], True - ) - e3 = find_atoms_in_molecule( - trajConfig["instance"].universe, self["molecule"], self["y_axis"], True - ) - - self["value"] = value - - self["basis"] = list(zip(e1, e2, e3)) - - self["n_basis"] = len(self["basis"]) - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "Basis vector:%s\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.UserDefinitionStore import UD_STORE +from MDANSE.Framework.Configurators.IConfigurator import IConfigurator +from MDANSE.MolecularDynamics.TrajectoryUtils import find_atoms_in_molecule + + +class BasisSelectionConfigurator(IConfigurator): + """ + This configurator allows to define a local basis per molecule. + + For each molecule, the basis is defined using the coordinates of three atoms of the molecule. + These coordinates will respectively define the origin, the X axis and y axis of the basis, the + Z axis being latter defined in such a way that the basis is direct. + """ + + _default = None + + def configure(self, value): + """ + Configure an input value. + + The value can be: + + #. a dict with *'molecule'*, *'origin'*, *'x_axis'* and *'y_axis'* keys. *'molecule'* key is \ + the name of the molecule for which the axis selection will be performed and *'origin'*, *'x_axis'* and *'y_axis'* \ + keys are the names of three atoms of the molecule that will be used to define respectively the origin, the X and Y axis of the basis + #. str: the axis selection will be performed by reading the corresponding user definition. + + :param value: the input value + :type value: tuple or str + + :note: this configurator depends on 'trajectory' configurator to be configured + """ + + trajConfig = self._configurable[self._dependencies["trajectory"]] + + if UD_STORE.has_definition(trajConfig["basename"], "basis_selection", value): + ud = UD_STORE.get_definition( + trajConfig["basename"], "basis_selection", value + ) + self.update(ud) + else: + self.update(value) + + e1 = find_atoms_in_molecule( + trajConfig["instance"].universe, self["molecule"], self["origin"], True + ) + e2 = find_atoms_in_molecule( + trajConfig["instance"].universe, self["molecule"], self["x_axis"], True + ) + e3 = find_atoms_in_molecule( + trajConfig["instance"].universe, self["molecule"], self["y_axis"], True + ) + + self["value"] = value + + self["basis"] = list(zip(e1, e2, e3)) + + self["n_basis"] = len(self["basis"]) + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "Basis vector:%s\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py index 24e21fe89c..3fde95a013 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py @@ -1,74 +1,78 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/BooleanConfigurator.py -# @brief Implements module/class/test BooleanConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class BooleanConfigurator(IConfigurator): - """ - This Configurator allows to input a Boolean Value (True or False). - - The input value can be directly provided as a Python boolean or by the using the following (standard) - representation of a boolean: 'true'/'false', 'yes'/'no', 'y'/'n', '1'/'0', 1/0 - """ - - _default = False - - _shortCuts = { - True: True, - "true": True, - "yes": True, - "y": True, - "1": True, - 1: True, - False: False, - "false": False, - "no": False, - "n": False, - "0": False, - 0: False, - } - - def configure(self, value): - """ - Configure an input value. - - The value must be one of True/False, 'true'/'false', 'yes'/'no', 'y'/'n', '1'/'0', 1/0. - - :param configuration: the current configuration - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the input value - :type value: one of True/False, 'true'/'false', 'yes'/'no', 'y'/'n', '1'/'0', 1/0 - """ - - if value not in self._shortCuts: - self.error_status = "Input is not recognised as a true/false value" - else: - self.error_status = "OK" - self["value"] = self._shortCuts[value] - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "Value: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class BooleanConfigurator(IConfigurator): + """ + This Configurator allows to input a Boolean Value (True or False). + + The input value can be directly provided as a Python boolean or by the using the following (standard) + representation of a boolean: 'true'/'false', 'yes'/'no', 'y'/'n', '1'/'0', 1/0 + """ + + _default = False + + _shortCuts = { + True: True, + "true": True, + "yes": True, + "y": True, + "1": True, + 1: True, + False: False, + "false": False, + "no": False, + "n": False, + "0": False, + 0: False, + } + + def configure(self, value): + """ + Configure an input value. + + The value must be one of True/False, 'true'/'false', 'yes'/'no', 'y'/'n', '1'/'0', 1/0. + + :param configuration: the current configuration + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the input value + :type value: one of True/False, 'true'/'false', 'yes'/'no', 'y'/'n', '1'/'0', 1/0 + """ + + if value not in self._shortCuts: + self.error_status = "Input is not recognised as a true/false value" + else: + self.error_status = "OK" + self["value"] = self._shortCuts[value] + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "Value: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py index 1e56cb6a57..eb94b25949 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Configurators/ConfigFileConfigurator.py -# @brief Implements module/class/test ConfigFileConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py index 003275f741..99f2d92be9 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Configurators/FieldFileConfigurator.py -# @brief Implements module/class/test FieldFileConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import re from MDANSE.Chemistry.ChemicalEntity import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FileWithAtomDataConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FileWithAtomDataConfigurator.py index eb7b56b631..bd8ada94b6 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FileWithAtomDataConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FileWithAtomDataConfigurator.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from abc import abstractmethod from MDANSE.Framework.AtomMapping import AtomLabel diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py index 1b1ed5a869..cc783f0cef 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py @@ -1,127 +1,131 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/FloatConfigurator.py -# @brief Implements module/class/test FloatConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class FloatConfigurator(IConfigurator): - """ - This Configurator allows to input a float. - """ - - _default = 0 - - def __init__(self, name, mini=None, maxi=None, choices=None, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param mini: the minimum value allowed for the input value. If None, no restriction for the minimum. - :type mini: float or None - :param maxi: the maximum value allowed for the input value. If None, no restriction for the maximum. - :type maxi: float or None - :param choices: the list of floats allowed for the input value. If None, any value will be allowed. - :type choices: list of float or None - """ - - # The base class constructor. - IConfigurator.__init__(self, name, **kwargs) - - self._mini = float(mini) if mini is not None else None - - self._maxi = float(maxi) if maxi is not None else None - - self._choices = choices if choices is not None else [] - - def configure(self, value): - """ - Configure an input value. - - :param value: the input value - :type value: float - """ - self["value"] = self._default - - try: - value = float(value) - except (TypeError, ValueError) as e: - self.error_status = f"Wrong value {value} in {self}" - return - - if self._choices: - if not value in self._choices: - self.error_status = "the input value is not a valid choice." - return - - if self._mini is not None: - if value < self._mini: - self.error_status = f"the input value is lower than {self._mini}" - return - - if self._maxi is not None: - if value > self._maxi: - self.error_status = f"the input value is higher than {self._maxi}" - return - - self.error_status = "OK" - self["value"] = value - - @property - def mini(self): - """ - Returns the minimum value allowed for an input float. - - :return: the minimum value allowed for an input float. - :rtype: float or None - """ - - return self._mini - - @property - def maxi(self): - """ - Returns the maximum value allowed for an input float. - - :return: the maximum value allowed for an input float. - :rtype: float or None - """ - - return self._maxi - - @property - def choices(self): - """ - Returns the list of floats allowed for an input float. - - :return: the choices allowed for an input float. - :rtype: list of floats or None - """ - - return self._choices - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "Value: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class FloatConfigurator(IConfigurator): + """ + This Configurator allows to input a float. + """ + + _default = 0 + + def __init__(self, name, mini=None, maxi=None, choices=None, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param mini: the minimum value allowed for the input value. If None, no restriction for the minimum. + :type mini: float or None + :param maxi: the maximum value allowed for the input value. If None, no restriction for the maximum. + :type maxi: float or None + :param choices: the list of floats allowed for the input value. If None, any value will be allowed. + :type choices: list of float or None + """ + + # The base class constructor. + IConfigurator.__init__(self, name, **kwargs) + + self._mini = float(mini) if mini is not None else None + + self._maxi = float(maxi) if maxi is not None else None + + self._choices = choices if choices is not None else [] + + def configure(self, value): + """ + Configure an input value. + + :param value: the input value + :type value: float + """ + self["value"] = self._default + + try: + value = float(value) + except (TypeError, ValueError) as e: + self.error_status = f"Wrong value {value} in {self}" + return + + if self._choices: + if not value in self._choices: + self.error_status = "the input value is not a valid choice." + return + + if self._mini is not None: + if value < self._mini: + self.error_status = f"the input value is lower than {self._mini}" + return + + if self._maxi is not None: + if value > self._maxi: + self.error_status = f"the input value is higher than {self._maxi}" + return + + self.error_status = "OK" + self["value"] = value + + @property + def mini(self): + """ + Returns the minimum value allowed for an input float. + + :return: the minimum value allowed for an input float. + :rtype: float or None + """ + + return self._mini + + @property + def maxi(self): + """ + Returns the maximum value allowed for an input float. + + :return: the maximum value allowed for an input float. + :rtype: float or None + """ + + return self._maxi + + @property + def choices(self): + """ + Returns the list of floats allowed for an input float. + + :return: the choices allowed for an input float. + :rtype: list of floats or None + """ + + return self._choices + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "Value: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py index c3c00cc3ca..6886a08bd9 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py @@ -1,108 +1,112 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/FramesConfigurator.py -# @brief Implements module/class/test FramesConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import numpy as np - -from MDANSE.Framework.Configurators.RangeConfigurator import RangeConfigurator - - -class FramesConfigurator(RangeConfigurator): - """ - This configurator allows to input a frame selection for the analysis. - - The frame selection can be input as: - - #. a 3-tuple where the 1st, 2nd will corresponds respectively to the indexes of the first and \ - last (excluded) frames to be selected while the 3rd element will correspond to the step number between two frames. For example (1,11,3) will give 1,4,7,10 - #. *'all'* keyword, in such case, all the frames of the trajectory are selected - #. ``None`` keyword, in such case, all the frames of the trajectory are selected - - :note: this configurator depends on 'trajectory' configurator to be configured - """ - - _label = "Subset of frames to be selected (first, last, step size)" - - def __init__(self, name, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - """ - - RangeConfigurator.__init__(self, name, sort=True, **kwargs) - - def configure(self, value): - """ - Configure the frames range that will be used to perform an analysis. - - :param value: the input value - :type value: 3-tuple, 'all' or None - """ - - trajConfig = self._configurable[self._dependencies["trajectory"]] - - input_is_num = True - try: - num_values = [int(x) for x in value[0:3]] - except: - input_is_num = False - else: - step_size = num_values[-1] - - if value in ["all", None]: - value = (0, trajConfig["length"], 1) - elif input_is_num and step_size == 0: - self.error_status = "Cannot create a range with a step=0" - return - elif not input_is_num: - self.error_status = "Input values must be numbers" - return - elif np.allclose(num_values, [0, -1, 1]): - value = (0, trajConfig["length"], 1) - - self._mini = 0 - self._maxi = trajConfig["length"] - - RangeConfigurator.configure(self, value) - if not self.valid: - return - - self["n_frames"] = self["number"] - - self["time"] = trajConfig["md_time_step"] * self["value"] - - # case of single frame selected - try: - self["time_step"] = self["time"][1] - self["time"][0] - except IndexError: - self["time_step"] = 1.0 - - self["duration"] = self["time"] - self["time"][0] - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "%d frames selected (first=%.3f ; last = %.3f ; time step = %.3f)\n" % ( - self["n_frames"], - self["time"][0], - self["time"][-1], - self["time_step"], - ) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import numpy as np + +from MDANSE.Framework.Configurators.RangeConfigurator import RangeConfigurator + + +class FramesConfigurator(RangeConfigurator): + """ + This configurator allows to input a frame selection for the analysis. + + The frame selection can be input as: + + #. a 3-tuple where the 1st, 2nd will corresponds respectively to the indexes of the first and \ + last (excluded) frames to be selected while the 3rd element will correspond to the step number between two frames. For example (1,11,3) will give 1,4,7,10 + #. *'all'* keyword, in such case, all the frames of the trajectory are selected + #. ``None`` keyword, in such case, all the frames of the trajectory are selected + + :note: this configurator depends on 'trajectory' configurator to be configured + """ + + _label = "Subset of frames to be selected (first, last, step size)" + + def __init__(self, name, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + """ + + RangeConfigurator.__init__(self, name, sort=True, **kwargs) + + def configure(self, value): + """ + Configure the frames range that will be used to perform an analysis. + + :param value: the input value + :type value: 3-tuple, 'all' or None + """ + + trajConfig = self._configurable[self._dependencies["trajectory"]] + + input_is_num = True + try: + num_values = [int(x) for x in value[0:3]] + except: + input_is_num = False + else: + step_size = num_values[-1] + + if value in ["all", None]: + value = (0, trajConfig["length"], 1) + elif input_is_num and step_size == 0: + self.error_status = "Cannot create a range with a step=0" + return + elif not input_is_num: + self.error_status = "Input values must be numbers" + return + elif np.allclose(num_values, [0, -1, 1]): + value = (0, trajConfig["length"], 1) + + self._mini = 0 + self._maxi = trajConfig["length"] + + RangeConfigurator.configure(self, value) + if not self.valid: + return + + self["n_frames"] = self["number"] + + self["time"] = trajConfig["md_time_step"] * self["value"] + + # case of single frame selected + try: + self["time_step"] = self["time"][1] - self["time"][0] + except IndexError: + self["time_step"] = 1.0 + + self["duration"] = self["time"] - self["time"][0] + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "%d frames selected (first=%.3f ; last = %.3f ; time step = %.3f)\n" % ( + self["n_frames"], + self["time"][0], + self["time"][-1], + self["time_step"], + ) diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py index 7329467de1..a9d4d73a91 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py @@ -1,174 +1,178 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/GroupingLevelConfigurator.py -# @brief Implements module/class/test GroupingLevelConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - - -from MDANSE.Framework.Configurators.SingleChoiceConfigurator import ( - SingleChoiceConfigurator, -) -from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms - -LEVELS = collections.OrderedDict() -LEVELS["atom"] = { - "atom": 0, - "atomcluster": 0, - "molecule": 0, - "nucleotidechain": 0, - "peptidechain": 0, - "protein": 0, -} -LEVELS["residue"] = { - "atom": 0, - "atomcluster": 1, - "molecule": 1, - "nucleotidechain": 1, - "peptidechain": 1, - "protein": 1, -} -LEVELS["chain"] = { - "atom": 0, - "atomcluster": 1, - "molecule": 1, - "nucleotidechain": 2, - "peptidechain": 2, - "protein": 2, -} -LEVELS["molecule"] = { - "atom": 0, - "atomcluster": 1, - "molecule": 1, - "nucleotidechain": 2, - "peptidechain": 2, - "protein": 2, -} - - -class GroupingLevelConfigurator(SingleChoiceConfigurator): - """ - This configurator allows to choose the level of granularity in the atom selection. - - When reading the trajectory, the level of granularity will be applied by grouping the atoms of the selection - to a single dummy-atoms located on the center of gravity of those atoms. - - The level of granularity currently supported are: - - * 'atom': no grouping will be performed - * 'group': the atoms that belongs to an AtomCluster object will be grouped as a single atom per object while the ones that belongs to a Molecule, NucleotideChain, PeptideChain and Protein object will be grouped according to the chemical group they belong to (e.g. peptide group, methyl group ...) - * 'residue': the atoms that belongs to anAtomCluster or Molecule object will be grouped as a single atom per object while the ones thta belongs to a NucleotideChain, PeptideChain or Protein object will be grouped according to the residue to which they belong to (e.g. Histidine, Cytosyl ...) - * 'chain': the atoms that belongs to an AtomCluster or Molecule object will be grouped as a single atom per object while the ones that belongs to a NucleotideChain, PeptideChain or Protein object will be grouped according to the chain they belong to - * 'molecule': the atoms that belongs to any chemical entity will be grouped as a single atom per object - """ - - _default = "atom" - - def __init__(self, name, choices=None, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration - :type name: str - :param choices: the level of granularities allowed for the input value. If None all levels are allowed. - :type choices: one of ['atom','group','residue','chain','molecule'] or None - """ - - if choices is None: - choices = list(LEVELS.keys()) - else: - choices = list(set(LEVELS.keys()).intersection(choices)) - - SingleChoiceConfigurator.__init__(self, name, choices=choices, **kwargs) - - def configure(self, value): - """ - :param value: the level of granularity at which the atoms should be grouped - :type value: str - """ - - if value is None: - value = "atom" - - value = str(value) - - SingleChoiceConfigurator.configure(self, value) - - if value == "atom": - return - - trajConfig = self._configurable[self._dependencies["trajectory"]] - atomSelectionConfig = self._configurable[self._dependencies["atom_selection"]] - - allAtoms = sorted_atoms(trajConfig["instance"].chemical_system.atom_list) - - groups = collections.OrderedDict() - for i in range(atomSelectionConfig["selection_length"]): - idx = atomSelectionConfig["indexes"][i][0] - el = atomSelectionConfig["elements"][i][0] - mass = atomSelectionConfig["masses"][i][0] - at = allAtoms[idx] - lvl = LEVELS[value][at.top_level_chemical_entity.__class__.__name__.lower()] - parent = self.find_parent(at, lvl) - d = groups.setdefault(parent, {}) - d.setdefault("indexes", []).append(idx) - d.setdefault("elements", []).append(el) - d.setdefault("masses", []).append(mass) - - indexes = [] - elements = [] - masses = [] - names = [] - for i, v in enumerate(groups.values()): - names.append("group_%d" % i) - elements.append(v["elements"]) - indexes.append(v["indexes"]) - masses.append(v["masses"]) - - atomSelectionConfig["indexes"] = indexes - atomSelectionConfig["elements"] = elements - atomSelectionConfig["masses"] = masses - atomSelectionConfig["names"] = names - atomSelectionConfig["selection_length"] = len(names) - atomSelectionConfig["unique_names"] = sorted(set(atomSelectionConfig["names"])) - - self["level"] = value - - @staticmethod - def find_parent(atom, level): - """ - Retrieve recursively the parent of a given atom at a given level. - For example, a level of 1 will return the direct parent of the atom. - - :note: this is a static method - - :param atom: the atom for which the parent is searched for - :type atom: Atom object - :param level: the level of the parent - :type level: int - """ - - for _ in range(level): - atom = atom.parent - - return atom - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "Grouping level: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + + +from MDANSE.Framework.Configurators.SingleChoiceConfigurator import ( + SingleChoiceConfigurator, +) +from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms + +LEVELS = collections.OrderedDict() +LEVELS["atom"] = { + "atom": 0, + "atomcluster": 0, + "molecule": 0, + "nucleotidechain": 0, + "peptidechain": 0, + "protein": 0, +} +LEVELS["residue"] = { + "atom": 0, + "atomcluster": 1, + "molecule": 1, + "nucleotidechain": 1, + "peptidechain": 1, + "protein": 1, +} +LEVELS["chain"] = { + "atom": 0, + "atomcluster": 1, + "molecule": 1, + "nucleotidechain": 2, + "peptidechain": 2, + "protein": 2, +} +LEVELS["molecule"] = { + "atom": 0, + "atomcluster": 1, + "molecule": 1, + "nucleotidechain": 2, + "peptidechain": 2, + "protein": 2, +} + + +class GroupingLevelConfigurator(SingleChoiceConfigurator): + """ + This configurator allows to choose the level of granularity in the atom selection. + + When reading the trajectory, the level of granularity will be applied by grouping the atoms of the selection + to a single dummy-atoms located on the center of gravity of those atoms. + + The level of granularity currently supported are: + + * 'atom': no grouping will be performed + * 'group': the atoms that belongs to an AtomCluster object will be grouped as a single atom per object while the ones that belongs to a Molecule, NucleotideChain, PeptideChain and Protein object will be grouped according to the chemical group they belong to (e.g. peptide group, methyl group ...) + * 'residue': the atoms that belongs to anAtomCluster or Molecule object will be grouped as a single atom per object while the ones thta belongs to a NucleotideChain, PeptideChain or Protein object will be grouped according to the residue to which they belong to (e.g. Histidine, Cytosyl ...) + * 'chain': the atoms that belongs to an AtomCluster or Molecule object will be grouped as a single atom per object while the ones that belongs to a NucleotideChain, PeptideChain or Protein object will be grouped according to the chain they belong to + * 'molecule': the atoms that belongs to any chemical entity will be grouped as a single atom per object + """ + + _default = "atom" + + def __init__(self, name, choices=None, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration + :type name: str + :param choices: the level of granularities allowed for the input value. If None all levels are allowed. + :type choices: one of ['atom','group','residue','chain','molecule'] or None + """ + + if choices is None: + choices = list(LEVELS.keys()) + else: + choices = list(set(LEVELS.keys()).intersection(choices)) + + SingleChoiceConfigurator.__init__(self, name, choices=choices, **kwargs) + + def configure(self, value): + """ + :param value: the level of granularity at which the atoms should be grouped + :type value: str + """ + + if value is None: + value = "atom" + + value = str(value) + + SingleChoiceConfigurator.configure(self, value) + + if value == "atom": + return + + trajConfig = self._configurable[self._dependencies["trajectory"]] + atomSelectionConfig = self._configurable[self._dependencies["atom_selection"]] + + allAtoms = sorted_atoms(trajConfig["instance"].chemical_system.atom_list) + + groups = collections.OrderedDict() + for i in range(atomSelectionConfig["selection_length"]): + idx = atomSelectionConfig["indexes"][i][0] + el = atomSelectionConfig["elements"][i][0] + mass = atomSelectionConfig["masses"][i][0] + at = allAtoms[idx] + lvl = LEVELS[value][at.top_level_chemical_entity.__class__.__name__.lower()] + parent = self.find_parent(at, lvl) + d = groups.setdefault(parent, {}) + d.setdefault("indexes", []).append(idx) + d.setdefault("elements", []).append(el) + d.setdefault("masses", []).append(mass) + + indexes = [] + elements = [] + masses = [] + names = [] + for i, v in enumerate(groups.values()): + names.append("group_%d" % i) + elements.append(v["elements"]) + indexes.append(v["indexes"]) + masses.append(v["masses"]) + + atomSelectionConfig["indexes"] = indexes + atomSelectionConfig["elements"] = elements + atomSelectionConfig["masses"] = masses + atomSelectionConfig["names"] = names + atomSelectionConfig["selection_length"] = len(names) + atomSelectionConfig["unique_names"] = sorted(set(atomSelectionConfig["names"])) + + self["level"] = value + + @staticmethod + def find_parent(atom, level): + """ + Retrieve recursively the parent of a given atom at a given level. + For example, a level of 1 will return the direct parent of the atom. + + :note: this is a static method + + :param atom: the atom for which the parent is searched for + :type atom: Atom object + :param level: the level of the parent + :type level: int + """ + + for _ in range(level): + atom = atom.parent + + return atom + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "Grouping level: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py index e68517bd3f..1f27b69079 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py @@ -1,129 +1,133 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/HDFInputFileConfigurator.py -# @brief Implements module/class/test HDFInputFileConfigurator -# -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import h5py - - -from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError -from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator -from MDANSE.IO.HDF import find_numeric_variables - - -class HDFInputFileConfigurator(InputFileConfigurator): - """ - This configurator allows to input an HDF file as input file. - """ - - _default = "INPUT_FILENAME.mda" - - def __init__( - self, - name, - variables=None, - wildcard="MDA analysis results (*.mda)|*.mda|HDF5 files (*.h5)|*.h5|All files|*", - **kwargs, - ): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param variables: the list of HDF variables that must be present in the input HDF file or None if there is no compulsory variable. - :type variables: list of str or None - """ - - # The base class constructor. - InputFileConfigurator.__init__(self, name, **kwargs) - - self._variables = variables if variables is not None else [] - self._units = {} - self._wildcard = wildcard - - def configure(self, value): - """ - Configure a HDF file. - - :param configuration: the current configuration. - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the path for the HDF file. - :type value: str - """ - - InputFileConfigurator.configure(self, value) - if not self._valid: - return - - try: - self["instance"] = h5py.File(self["value"], "r") - - except IOError: - self.error_status = f"can not open {value} HDF file for reading" - return - - for v in self._variables: - if v in self["instance"]: - self[v] = self["instance"][v][:] - try: - self._units[v] = self["instance"][v].attrs["units"] - except: - self._units[v] = "unitless" - else: - self.error_status = ( - f"the variable {v} was not found in {value} HDF file" - ) - return - self.error_status = "OK" - - @property - def wildcard(self): - """ - Returns the wildcard used to filter the input file. - - :return: the wildcard used to filter the input file. - :rtype: str - """ - - return self._wildcard - - @property - def variables(self): - """ - Returns the list of HDF variables that must be present in the HDF file. - - :return: the list of HDF variables that must be present in the HDF file. - :rtype: list of str - """ - - return self._variables - - def get_information(self): - """ - Returns some basic informations about the contents of the HDF file. - - :return: the informations about the contents of the HDF file. - :rtype: str - """ - - info = ["HDF input file: %r" % self["value"]] - - if "instance" in self: - info.append("Contains the following variables:") - variables = [] - find_numeric_variables(variables, self["instance"]) - - for v in variables: - info.append("\t-{}".format(v)) - - return "\n".join(info) + "\n" +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import h5py + + +from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError +from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator +from MDANSE.IO.HDF import find_numeric_variables + + +class HDFInputFileConfigurator(InputFileConfigurator): + """ + This configurator allows to input an HDF file as input file. + """ + + _default = "INPUT_FILENAME.mda" + + def __init__( + self, + name, + variables=None, + wildcard="MDA analysis results (*.mda)|*.mda|HDF5 files (*.h5)|*.h5|All files|*", + **kwargs, + ): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param variables: the list of HDF variables that must be present in the input HDF file or None if there is no compulsory variable. + :type variables: list of str or None + """ + + # The base class constructor. + InputFileConfigurator.__init__(self, name, **kwargs) + + self._variables = variables if variables is not None else [] + self._units = {} + self._wildcard = wildcard + + def configure(self, value): + """ + Configure a HDF file. + + :param configuration: the current configuration. + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the path for the HDF file. + :type value: str + """ + + InputFileConfigurator.configure(self, value) + if not self._valid: + return + + try: + self["instance"] = h5py.File(self["value"], "r") + + except IOError: + self.error_status = f"can not open {value} HDF file for reading" + return + + for v in self._variables: + if v in self["instance"]: + self[v] = self["instance"][v][:] + try: + self._units[v] = self["instance"][v].attrs["units"] + except: + self._units[v] = "unitless" + else: + self.error_status = ( + f"the variable {v} was not found in {value} HDF file" + ) + return + self.error_status = "OK" + + @property + def wildcard(self): + """ + Returns the wildcard used to filter the input file. + + :return: the wildcard used to filter the input file. + :rtype: str + """ + + return self._wildcard + + @property + def variables(self): + """ + Returns the list of HDF variables that must be present in the HDF file. + + :return: the list of HDF variables that must be present in the HDF file. + :rtype: list of str + """ + + return self._variables + + def get_information(self): + """ + Returns some basic informations about the contents of the HDF file. + + :return: the informations about the contents of the HDF file. + :rtype: str + """ + + info = ["HDF input file: %r" % self["value"]] + + if "instance" in self: + info.append("Contains the following variables:") + variables = [] + find_numeric_variables(variables, self["instance"]) + + for v in variables: + info.append("\t-{}".format(v)) + + return "\n".join(info) + "\n" diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py index 215b2a5b0c..9e102ac10c 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py @@ -1,90 +1,94 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/HDFTrajectoryConfigurator.py -# @brief Implements module/class/test HDFTrajectoryConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os - -from MDANSE import PLATFORM - -from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator -from MDANSE.Framework.InputData.IInputData import IInputData - - -class HDFTrajectoryConfigurator(InputFileConfigurator): - """ - This configurator allow to input a HDF trajectory file. - - HDF trajectory file is the format used in MDANSE to store Molecular Dynamics trajectories. It is an HDF5 file - that store various data related to the molecular dynamics : atomic positions, velocities, energies, energy gradients etc... - - To use trajectories derived from MD packages different from HDF, it is compulsory to convert them before to a - HDF trajectory file. - - :attention: once configured, the HDF trajectory file will be opened for reading. - """ - - _default = "INPUT_FILENAME.mdt" - _label = "MDANSE trajectory file" - - def configure(self, value): - """ - Configure a HDF trajectory file. - - :param value: the path for the HDF trajectory file. - :type value: str - """ - - InputFileConfigurator.configure(self, value) - - inputTraj = IInputData.create("HDFTrajectoryInputData", self["value"]) - - self["hdf_trajectory"] = inputTraj - - self["instance"] = inputTraj.trajectory - - self["filename"] = PLATFORM.get_path(inputTraj.filename) - - self["basename"] = os.path.basename(self["filename"]) - - self["length"] = len(self["instance"]) - - try: - self["md_time_step"] = ( - self["instance"].file["/time"][1] - self["instance"].file["/time"][0] - ) - except IndexError: - self["md_time_step"] = 1.0 - - self["has_velocities"] = "velocities" in self["instance"].file["/configuration"] - - def get_information(self): - """ - Returns some basic informations about the contents of the HDF trajectory file. - - :return: the informations about the contents of the HDF trajectory file. - :rtype: str - """ - - info = ["HDF input trajectory: %r\n" % self["filename"]] - info.append("Number of steps: %d\n" % self["length"]) - info.append( - "Size of the chemical system: %d\n" - % self["instance"].chemical_system.number_of_atoms - ) - if self["has_velocities"]: - info.append("The trajectory contains atomic velocities\n") - else: - info.append("The trajectory does not contain atomic velocities\n") - - return "".join(info) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os + +from MDANSE import PLATFORM + +from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator +from MDANSE.Framework.InputData.IInputData import IInputData + + +class HDFTrajectoryConfigurator(InputFileConfigurator): + """ + This configurator allow to input a HDF trajectory file. + + HDF trajectory file is the format used in MDANSE to store Molecular Dynamics trajectories. It is an HDF5 file + that store various data related to the molecular dynamics : atomic positions, velocities, energies, energy gradients etc... + + To use trajectories derived from MD packages different from HDF, it is compulsory to convert them before to a + HDF trajectory file. + + :attention: once configured, the HDF trajectory file will be opened for reading. + """ + + _default = "INPUT_FILENAME.mdt" + _label = "MDANSE trajectory file" + + def configure(self, value): + """ + Configure a HDF trajectory file. + + :param value: the path for the HDF trajectory file. + :type value: str + """ + + InputFileConfigurator.configure(self, value) + + inputTraj = IInputData.create("HDFTrajectoryInputData", self["value"]) + + self["hdf_trajectory"] = inputTraj + + self["instance"] = inputTraj.trajectory + + self["filename"] = PLATFORM.get_path(inputTraj.filename) + + self["basename"] = os.path.basename(self["filename"]) + + self["length"] = len(self["instance"]) + + try: + self["md_time_step"] = ( + self["instance"].file["/time"][1] - self["instance"].file["/time"][0] + ) + except IndexError: + self["md_time_step"] = 1.0 + + self["has_velocities"] = "velocities" in self["instance"].file["/configuration"] + + def get_information(self): + """ + Returns some basic informations about the contents of the HDF trajectory file. + + :return: the informations about the contents of the HDF trajectory file. + :rtype: str + """ + + info = ["HDF input trajectory: %r\n" % self["filename"]] + info.append("Number of steps: %d\n" % self["length"]) + info.append( + "Size of the chemical system: %d\n" + % self["instance"].chemical_system.number_of_atoms + ) + if self["has_velocities"]: + info.append("The trajectory contains atomic velocities\n") + else: + info.append("The trajectory does not contain atomic velocities\n") + + return "".join(info) diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py index ea93c0a137..34d9d836f1 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py @@ -1,299 +1,303 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/IConfigurator.py -# @brief Implements module/class/test IConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import abc - -from MDANSE.Core.Error import Error - -from MDANSE.Core.SubclassFactory import SubclassFactory - - -class ConfiguratorError(Error): - """ - This class handles any exception related to Configurator-derived object - """ - - def __init__(self, message, configurator=None): - """ - Initializes the the object. - - :param message: the exception message - :type message: str - :param configurator: the configurator in which the exception was raised - :type configurator: an instance or derived instance of a MDANSE.Framework.Configurators.Configurator object - """ - - self._message = message - self._configurator = configurator - - def __str__(self): - """ - Returns the informal string representation of this object. - - :return: the informal string representation of this object - :rtype: str - """ - - if self._configurator is not None: - self._message = "Configurator: %r --> %s" % ( - self._configurator.name, - self._message, - ) - - return self._message - - @property - def configurator(self): - """ - Returns the configurator in which the exception was raised - - :return: the configurator in which the exception was raised - :rtype: an instance or derived instance of a MDANSE.Framework.Configurators.Configurator object - """ - return self._configurator - - -class IConfigurator(dict, metaclass=SubclassFactory): - """ - This class implements the base class for configurator objects. A configurator object is a dictionary-derived object that is used - to configure one item of a given configuration. Once the input value given for that item is configured, the dictionary is updated - with keys/values providing information about this item. - - A configurator is not designed to be used as a stand-alone object. It should be used within the scope of a Configurable object that - will store a complete configuration for a given task (e.g. job, Q vectors, instrument resolution ...). - - Usually, configurator objects are self-consistent but for complex ones, it can happen that they depends on other configurators of the - configuration. - """ - - _default = None - - _doc_ = "undocumented" - - def __init__(self, name, **kwargs): - """ - Initializes a configurator object. - - :param name: the name of this configurator. - :type name: str - :param dependencies: the other configurators on which this configurator depends on to be configured. \ - This has to be input as a dictionary that maps the name under which the dependency will be used within \ - the configurator implementation to the actual name of the configurator on which this configurator is depending on. - :type dependencies: (str,str)-dict - :param default: the default value of this configurator. - :type default: any python object - :param label: the label of the panel in which this configurator will be inserted in the MDANSE GUI. - :type label: str - :param widget: the configurator widget that corresponds to this configurator. - :type widget: str - """ - - self._name = name - - self._configurable = kwargs.get("configurable", None) - - self._root = kwargs.get("root", None) - - self._dependencies = kwargs.get("dependencies", {}) - - self._default = kwargs.get("default", self.__class__._default) - - self._label = kwargs.get( - "label", - ( - self.__class__._label - if hasattr(self.__class__, "_label") - else " ".join(name.split("_")).strip() - ), - ) - - self._widget = kwargs.get("widget", self.__class__) - - self._optional = kwargs.get("optional", False) - - self._configured = False - - self._valid = True - - self._error_status = "OK" - - @property - def configurable(self): - return self._configurable - - @property - def default(self): - """ - Returns the default value of this configurator. - - :return: the default value of this configurator. - :rtype: any Python object - """ - - return self._default - - @property - def dependencies(self): - """ - Returns the dependencies maps of this configurator. - - :return: the dependencies maps of this configurator. - :rtype: (str,str)-dict - """ - - return self._dependencies - - @property - def label(self): - """ - Returns the label of this configurator that will be used when inserting its corresponding widget in a configuration panel. - - :return: the label of this configurator. - :rtype: str - """ - - return self._label - - @property - def name(self): - """ - Returns the name of this configurator. That name will be used as a key of a Configurable object. - - :return: the name of this configurator. - :rtype: str - """ - - return self._name - - @property - def valid(self): - """Tells if the current value stored by the configurator - is a valid input. - There is no benefit in rejecting the entire configuration - and killing the GUI just because a value needs to be corrected. - Instead the GUI should highlight the values that need correcting. - - Returns - ------- - bool - true if the current value stored by the configurator can be used - """ - return self._valid - - @property - def error_status(self): - return self._error_status - - @error_status.setter - def error_status(self, error_text: str): - """Sets the string explaining why the current input - cannot be accepted. - - If the string is longer than 'OK', the self._valid - flag is set to False. - - Parameters - ---------- - error_text : str - Text explaining why the current input is invalid - """ - self._error_status = error_text - if len(self._error_status) > 2: - self._valid = False - else: - self._valid = True - - @property - def optional(self): - """ - Returns the optional state name of this configurator. - - :return: the optional state. - :rtype: boolean - """ - - return self._optional - - @property - def root(self): - return self._root - - @property - def widget(self): - """ - Returns the name of the widget that will be associated to this configurator. - - :return: the name of the configurator-widget. - :rtype: str - """ - - return self._widget - - @abc.abstractmethod - def configure(self, value): - """ - Configures this configurator with a given value. - - :param value: the input value to be configured. - :type value: depends on the configurator - - :note: this is an abstract method. - """ - - def set_configured(self, configured): - self._configured = configured - - def is_configured(self): - return self._configured - - def set_configurable(self, configurable): - self._configurable = configurable - - def check_dependencies(self, configured=None): - """ - Check that the configurators on which this configurator depends on have already been configured. - - :param configured: the names of the configurators that have already been configured when configuring this configurator. - :type: list of str - - :return: True if the configurators on which this configurator depends on have already been configured. False otherwise. - :rtype: bool - """ - - if configured == None: - names = [str(key) for key in self._configurable._configuration.keys()] - configured = [ - name - for name in names - if self._configurable._configuration[name].is_configured() - ] - - for c in list(self._dependencies.values()): - if c not in configured: - return False - - return True - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - - :note: this is an abstract method. - """ - - return "" +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import abc + +from MDANSE.Core.Error import Error + +from MDANSE.Core.SubclassFactory import SubclassFactory + + +class ConfiguratorError(Error): + """ + This class handles any exception related to Configurator-derived object + """ + + def __init__(self, message, configurator=None): + """ + Initializes the the object. + + :param message: the exception message + :type message: str + :param configurator: the configurator in which the exception was raised + :type configurator: an instance or derived instance of a MDANSE.Framework.Configurators.Configurator object + """ + + self._message = message + self._configurator = configurator + + def __str__(self): + """ + Returns the informal string representation of this object. + + :return: the informal string representation of this object + :rtype: str + """ + + if self._configurator is not None: + self._message = "Configurator: %r --> %s" % ( + self._configurator.name, + self._message, + ) + + return self._message + + @property + def configurator(self): + """ + Returns the configurator in which the exception was raised + + :return: the configurator in which the exception was raised + :rtype: an instance or derived instance of a MDANSE.Framework.Configurators.Configurator object + """ + return self._configurator + + +class IConfigurator(dict, metaclass=SubclassFactory): + """ + This class implements the base class for configurator objects. A configurator object is a dictionary-derived object that is used + to configure one item of a given configuration. Once the input value given for that item is configured, the dictionary is updated + with keys/values providing information about this item. + + A configurator is not designed to be used as a stand-alone object. It should be used within the scope of a Configurable object that + will store a complete configuration for a given task (e.g. job, Q vectors, instrument resolution ...). + + Usually, configurator objects are self-consistent but for complex ones, it can happen that they depends on other configurators of the + configuration. + """ + + _default = None + + _doc_ = "undocumented" + + def __init__(self, name, **kwargs): + """ + Initializes a configurator object. + + :param name: the name of this configurator. + :type name: str + :param dependencies: the other configurators on which this configurator depends on to be configured. \ + This has to be input as a dictionary that maps the name under which the dependency will be used within \ + the configurator implementation to the actual name of the configurator on which this configurator is depending on. + :type dependencies: (str,str)-dict + :param default: the default value of this configurator. + :type default: any python object + :param label: the label of the panel in which this configurator will be inserted in the MDANSE GUI. + :type label: str + :param widget: the configurator widget that corresponds to this configurator. + :type widget: str + """ + + self._name = name + + self._configurable = kwargs.get("configurable", None) + + self._root = kwargs.get("root", None) + + self._dependencies = kwargs.get("dependencies", {}) + + self._default = kwargs.get("default", self.__class__._default) + + self._label = kwargs.get( + "label", + ( + self.__class__._label + if hasattr(self.__class__, "_label") + else " ".join(name.split("_")).strip() + ), + ) + + self._widget = kwargs.get("widget", self.__class__) + + self._optional = kwargs.get("optional", False) + + self._configured = False + + self._valid = True + + self._error_status = "OK" + + @property + def configurable(self): + return self._configurable + + @property + def default(self): + """ + Returns the default value of this configurator. + + :return: the default value of this configurator. + :rtype: any Python object + """ + + return self._default + + @property + def dependencies(self): + """ + Returns the dependencies maps of this configurator. + + :return: the dependencies maps of this configurator. + :rtype: (str,str)-dict + """ + + return self._dependencies + + @property + def label(self): + """ + Returns the label of this configurator that will be used when inserting its corresponding widget in a configuration panel. + + :return: the label of this configurator. + :rtype: str + """ + + return self._label + + @property + def name(self): + """ + Returns the name of this configurator. That name will be used as a key of a Configurable object. + + :return: the name of this configurator. + :rtype: str + """ + + return self._name + + @property + def valid(self): + """Tells if the current value stored by the configurator + is a valid input. + There is no benefit in rejecting the entire configuration + and killing the GUI just because a value needs to be corrected. + Instead the GUI should highlight the values that need correcting. + + Returns + ------- + bool + true if the current value stored by the configurator can be used + """ + return self._valid + + @property + def error_status(self): + return self._error_status + + @error_status.setter + def error_status(self, error_text: str): + """Sets the string explaining why the current input + cannot be accepted. + + If the string is longer than 'OK', the self._valid + flag is set to False. + + Parameters + ---------- + error_text : str + Text explaining why the current input is invalid + """ + self._error_status = error_text + if len(self._error_status) > 2: + self._valid = False + else: + self._valid = True + + @property + def optional(self): + """ + Returns the optional state name of this configurator. + + :return: the optional state. + :rtype: boolean + """ + + return self._optional + + @property + def root(self): + return self._root + + @property + def widget(self): + """ + Returns the name of the widget that will be associated to this configurator. + + :return: the name of the configurator-widget. + :rtype: str + """ + + return self._widget + + @abc.abstractmethod + def configure(self, value): + """ + Configures this configurator with a given value. + + :param value: the input value to be configured. + :type value: depends on the configurator + + :note: this is an abstract method. + """ + + def set_configured(self, configured): + self._configured = configured + + def is_configured(self): + return self._configured + + def set_configurable(self, configurable): + self._configurable = configurable + + def check_dependencies(self, configured=None): + """ + Check that the configurators on which this configurator depends on have already been configured. + + :param configured: the names of the configurators that have already been configured when configuring this configurator. + :type: list of str + + :return: True if the configurators on which this configurator depends on have already been configured. False otherwise. + :rtype: bool + """ + + if configured == None: + names = [str(key) for key in self._configurable._configuration.keys()] + configured = [ + name + for name in names + if self._configurable._configuration[name].is_configured() + ] + + for c in list(self._dependencies.values()): + if c not in configured: + return False + + return True + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + + :note: this is an abstract method. + """ + + return "" diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py index cb705dbbf4..b0aa6c085c 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py @@ -1,55 +1,59 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/InputDirectoryConfigurator.py -# @brief Implements module/class/test InputDirectoryConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os - -from MDANSE import PLATFORM -from MDANSE.Framework.Configurators.IConfigurator import IConfigurator - - -class InputDirectoryConfigurator(IConfigurator): - """ - This Configurator allows to set an input directory. - - :attention: The directory will be created at configuration time if it does not exist. - """ - - _default = os.getcwd() - - def configure(self, value): - """ - Configure an input directory. - - :param configuration: the current configuration. - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the input directory. - :type value: str - """ - - value = PLATFORM.get_path(value) - - PLATFORM.create_directory(value) - - self["value"] = value - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "Input directory: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os + +from MDANSE import PLATFORM +from MDANSE.Framework.Configurators.IConfigurator import IConfigurator + + +class InputDirectoryConfigurator(IConfigurator): + """ + This Configurator allows to set an input directory. + + :attention: The directory will be created at configuration time if it does not exist. + """ + + _default = os.getcwd() + + def configure(self, value): + """ + Configure an input directory. + + :param configuration: the current configuration. + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the input directory. + :type value: str + """ + + value = PLATFORM.get_path(value) + + PLATFORM.create_directory(value) + + self["value"] = value + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "Input directory: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py index e7767b5f6f..537224d95b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py @@ -1,85 +1,89 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/InputFileConfigurator.py -# @brief Implements module/class/test InputFileConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os - -from MDANSE import PLATFORM -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class InputFileConfigurator(IConfigurator): - """ - This Configurator allows to set an input file. - """ - - _default = "" - - def __init__(self, name, wildcard="All files|*", **kwargs): - """ - Initializes the configurator object. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param wildcard: the wildcard used to filter the file. This will be used in MDANSE GUI when - browsing for the input file. - :type wildcard: str - """ - - # The base class constructor. - IConfigurator.__init__(self, name, **kwargs) - - self._wildcard = wildcard - - def configure(self, value): - """ - Configure an input file. - - :param value: the input file. - :type value: str - """ - - value = PLATFORM.get_path(value) - - if not os.path.exists(value): - self.error_status = f"The file {value} does not exist" - return - - self["value"] = value - self["filename"] = value - self.error_status = "OK" - - @property - def wildcard(self): - """ - Returns the wildcard used to filter the input file. - - :return: the wildcard used to filter the input file. - :rtype: str - """ - - return self._wildcard - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "Input file: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os + +from MDANSE import PLATFORM +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class InputFileConfigurator(IConfigurator): + """ + This Configurator allows to set an input file. + """ + + _default = "" + + def __init__(self, name, wildcard="All files|*", **kwargs): + """ + Initializes the configurator object. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param wildcard: the wildcard used to filter the file. This will be used in MDANSE GUI when + browsing for the input file. + :type wildcard: str + """ + + # The base class constructor. + IConfigurator.__init__(self, name, **kwargs) + + self._wildcard = wildcard + + def configure(self, value): + """ + Configure an input file. + + :param value: the input file. + :type value: str + """ + + value = PLATFORM.get_path(value) + + if not os.path.exists(value): + self.error_status = f"The file {value} does not exist" + return + + self["value"] = value + self["filename"] = value + self.error_status = "OK" + + @property + def wildcard(self): + """ + Returns the wildcard used to filter the input file. + + :return: the wildcard used to filter the input file. + :rtype: str + """ + + return self._wildcard + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "Input file: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py index 1d189de4ee..bc1b6b2203 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py @@ -1,115 +1,119 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/InstrumentResolutionConfigurator.py -# @brief Implements module/class/test InstrumentResolutionConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import numpy as np - - -from MDANSE.Framework.Configurators.IConfigurator import IConfigurator -from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( - IInstrumentResolution, -) - - -class InstrumentResolutionConfigurator(IConfigurator): - """ - This configurator allows to set an instrument resolution. - - The instrument resolution will be used in frequency-dependant analysis (e.g. the vibrational density - of states) when performing the fourier transform of its time-dependant counterpart. This allow to - convolute of the signal with a resolution function to have a better match with experimental spectrum. - - In MDANSE, the instrument resolution are defined in omegas space and are internally - inverse-fourier-transformed to get a time-dependant version. This time-dependant resolution function will then - be multiplied by the time-dependant signal to get the resolution effect according to the Fourier Transform theorem: - - .. math:: TF(f(t) * r(t)) = F(\omega) \otimes R(\omega) = G(\omega) - - where f(t) and r(t) are respectively the time-dependant signal and instrument resolution and - F(\omega) and R(\omega) are their corresponding spectrum. Hence, G(\omega) represents the signal - convoluted by the instrument resolution and, as such, represents the quantity to be compared directly with - experimental results. - - An instrument resolution is represented in MDANSE by a kernel function and a sets of parameters for this function. - MDANSE currently supports the aussian, lorentzian, square, triangular and pseudo-voigt kernels. - - :note: this configurator depends on the 'frame' configurator to be configured. - """ - - _default = ("gaussian", {"mu": 0.0, "sigma": 10.0}) - - def configure(self, value): - """ - Configure the instrument resolution. - - :param value: the instrument resolution. It must a 2-tuple where the 1st element is the \ - is a string representing one of the supported instrument resolution and the 2nd element \ - is a dictionary that stores the parameters for this kernel. - :type value: 2-tuple - """ - - framesCfg = self._configurable[self._dependencies["frames"]] - - time = framesCfg["time"] - self["n_frames"] = len(time) - - self._timeStep = framesCfg["time"][1] - framesCfg["time"][0] - self["time_step"] = self._timeStep - - # We compute angular frequency AND NOT ORDINARY FREQUENCY ANYMORE - self["omega"] = ( - 2.0 - * np.pi - * np.fft.fftshift( - np.fft.fftfreq(2 * self["n_frames"] - 1, self["time_step"]) - ) - ) - - self["n_omegas"] = len(self["omega"]) - - kernel, parameters = value - - resolution = IInstrumentResolution.create(kernel) - - resolution.setup(parameters) - - resolution.set_kernel(self["omega"], self["time_step"]) - - self["omega_window"] = resolution.omegaWindow - - self["time_window"] = resolution.timeWindow.real - - self["kernel"] = kernel - self["parameters"] = parameters - - def get_information(self): - """ - Returns some informations the instrument resolution. - - :return: the information the instrument resolution. - :rtype: str - """ - - if "kernel" not in self: - return "No configured yet" - - info = ["Instrument resolution kernel: %s" % self["kernel"]] - if self["parameters"]: - info.append("Parameters:") - for k, v in list(self["parameters"].items()): - info.append("%s = %s" % (k, v)) - - info = "\n".join(info) - - return info + "\n" +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import numpy as np + + +from MDANSE.Framework.Configurators.IConfigurator import IConfigurator +from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( + IInstrumentResolution, +) + + +class InstrumentResolutionConfigurator(IConfigurator): + """ + This configurator allows to set an instrument resolution. + + The instrument resolution will be used in frequency-dependant analysis (e.g. the vibrational density + of states) when performing the fourier transform of its time-dependant counterpart. This allow to + convolute of the signal with a resolution function to have a better match with experimental spectrum. + + In MDANSE, the instrument resolution are defined in omegas space and are internally + inverse-fourier-transformed to get a time-dependant version. This time-dependant resolution function will then + be multiplied by the time-dependant signal to get the resolution effect according to the Fourier Transform theorem: + + .. math:: TF(f(t) * r(t)) = F(\omega) \otimes R(\omega) = G(\omega) + + where f(t) and r(t) are respectively the time-dependant signal and instrument resolution and + F(\omega) and R(\omega) are their corresponding spectrum. Hence, G(\omega) represents the signal + convoluted by the instrument resolution and, as such, represents the quantity to be compared directly with + experimental results. + + An instrument resolution is represented in MDANSE by a kernel function and a sets of parameters for this function. + MDANSE currently supports the aussian, lorentzian, square, triangular and pseudo-voigt kernels. + + :note: this configurator depends on the 'frame' configurator to be configured. + """ + + _default = ("gaussian", {"mu": 0.0, "sigma": 10.0}) + + def configure(self, value): + """ + Configure the instrument resolution. + + :param value: the instrument resolution. It must a 2-tuple where the 1st element is the \ + is a string representing one of the supported instrument resolution and the 2nd element \ + is a dictionary that stores the parameters for this kernel. + :type value: 2-tuple + """ + + framesCfg = self._configurable[self._dependencies["frames"]] + + time = framesCfg["time"] + self["n_frames"] = len(time) + + self._timeStep = framesCfg["time"][1] - framesCfg["time"][0] + self["time_step"] = self._timeStep + + # We compute angular frequency AND NOT ORDINARY FREQUENCY ANYMORE + self["omega"] = ( + 2.0 + * np.pi + * np.fft.fftshift( + np.fft.fftfreq(2 * self["n_frames"] - 1, self["time_step"]) + ) + ) + + self["n_omegas"] = len(self["omega"]) + + kernel, parameters = value + + resolution = IInstrumentResolution.create(kernel) + + resolution.setup(parameters) + + resolution.set_kernel(self["omega"], self["time_step"]) + + self["omega_window"] = resolution.omegaWindow + + self["time_window"] = resolution.timeWindow.real + + self["kernel"] = kernel + self["parameters"] = parameters + + def get_information(self): + """ + Returns some informations the instrument resolution. + + :return: the information the instrument resolution. + :rtype: str + """ + + if "kernel" not in self: + return "No configured yet" + + info = ["Instrument resolution kernel: %s" % self["kernel"]] + if self["parameters"]: + info.append("Parameters:") + for k, v in list(self["parameters"].items()): + info.append("%s = %s" % (k, v)) + + info = "\n".join(info) + + return info + "\n" diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py index 3eb32ff16e..86aa2881ed 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py @@ -1,136 +1,140 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/IntegerConfigurator.py -# @brief Implements module/class/test IntegerConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class IntegerConfigurator(IConfigurator): - """ - This Configurator allows to input an integer. - """ - - _default = 0 - - def __init__( - self, name, mini=None, maxi=None, choices=None, exclude=None, **kwargs - ): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param mini: the minimum value allowed for the input value. If None, no restriction for the minimum. - :type mini: int or None - :param maxi: the maximum value allowed for the input value. If None, no restriction for the maximum. - :type maxi: int or None - :param choices: the list of integers allowed for the input value. If None, any value will be allowed. - :type choices: int-list or None - """ - - # The base class constructor. - IConfigurator.__init__(self, name, **kwargs) - - self._mini = int(mini) if mini is not None else None - - self._maxi = int(maxi) if maxi is not None else None - - self._choices = choices if choices is not None else [] - - self._exclude = exclude if exclude is not None else () - - def configure(self, value): - """ - Configure an integer value. - - :param value: the integer to be configured. - :type value: int - """ - self["value"] = self._default - - try: - value = int(value) - except (TypeError, ValueError) as e: - self.error_status = "Wrong input for an integer" + str(e) - return - - if self._choices: - if not value in self._choices: - self.error_status = "the input value is not a valid choice." - return - - if self._mini is not None: - if value < self._mini: - self.error_status = f"the input value is lower than {self._mini}" - return - - if self._maxi is not None: - if value > self._maxi: - self.error_status = f"the input value is higher than {self._maxi}" - return - - if self._exclude: - if value in self._exclude: - self.error_status = f"the input value is forbidden; forbidden values are {self._exclude}" - return - - self["value"] = value - self.error_status = "OK" - - @property - def mini(self): - """ - Returns the minimum value allowed for an input integer. - - :return: the minimum value allowed for an input value integer. - :rtype: int or None - """ - - return self._mini - - @property - def maxi(self): - """ - Returns the maximum value allowed for an input integer. - - :return: the maximum value allowed for an input value integer. - :rtype: int or None - """ - - return self._maxi - - @property - def choices(self): - """ - Returns the list of integers allowed for an input float. - - :return: the choices allowed for an input float. - :rtype: int-list or None - """ - - return self._choices - - def get_information(self): - """ - Returns some informations about this configurator. - - :return: the information about this configurator - :rtype: str - """ - - return "Value: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class IntegerConfigurator(IConfigurator): + """ + This Configurator allows to input an integer. + """ + + _default = 0 + + def __init__( + self, name, mini=None, maxi=None, choices=None, exclude=None, **kwargs + ): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param mini: the minimum value allowed for the input value. If None, no restriction for the minimum. + :type mini: int or None + :param maxi: the maximum value allowed for the input value. If None, no restriction for the maximum. + :type maxi: int or None + :param choices: the list of integers allowed for the input value. If None, any value will be allowed. + :type choices: int-list or None + """ + + # The base class constructor. + IConfigurator.__init__(self, name, **kwargs) + + self._mini = int(mini) if mini is not None else None + + self._maxi = int(maxi) if maxi is not None else None + + self._choices = choices if choices is not None else [] + + self._exclude = exclude if exclude is not None else () + + def configure(self, value): + """ + Configure an integer value. + + :param value: the integer to be configured. + :type value: int + """ + self["value"] = self._default + + try: + value = int(value) + except (TypeError, ValueError) as e: + self.error_status = "Wrong input for an integer" + str(e) + return + + if self._choices: + if not value in self._choices: + self.error_status = "the input value is not a valid choice." + return + + if self._mini is not None: + if value < self._mini: + self.error_status = f"the input value is lower than {self._mini}" + return + + if self._maxi is not None: + if value > self._maxi: + self.error_status = f"the input value is higher than {self._maxi}" + return + + if self._exclude: + if value in self._exclude: + self.error_status = f"the input value is forbidden; forbidden values are {self._exclude}" + return + + self["value"] = value + self.error_status = "OK" + + @property + def mini(self): + """ + Returns the minimum value allowed for an input integer. + + :return: the minimum value allowed for an input value integer. + :rtype: int or None + """ + + return self._mini + + @property + def maxi(self): + """ + Returns the maximum value allowed for an input integer. + + :return: the maximum value allowed for an input value integer. + :rtype: int or None + """ + + return self._maxi + + @property + def choices(self): + """ + Returns the list of integers allowed for an input float. + + :return: the choices allowed for an input float. + :rtype: int-list or None + """ + + return self._choices + + def get_information(self): + """ + Returns some informations about this configurator. + + :return: the information about this configurator + :rtype: str + """ + + return "Value: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py index fae87c3828..8d2372d02d 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py @@ -1,70 +1,74 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/InterpolationOrderConfigurator.py -# @brief Implements module/class/test InterpolationOrderConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError -from MDANSE.Framework.Configurators.IntegerConfigurator import IntegerConfigurator - - -class InterpolationOrderConfigurator(IntegerConfigurator): - """ - This configurator allows to input the interpolation order to be applied when deriving velocities from atomic coordinates. - - The allowed value are *'no interpolation'*,*'1st order'*,*'2nd order'*,*'3rd order'*,*'4th order'* or *'5th order'*, the - former one will not interpolate the velocities from atomic coordinates but will directly use the velocities stored in the trajectory file. - - :attention: it is of paramount importance for the trajectory to be sampled with a very low time \ - step to get accurate velocities interpolated from atomic coordinates. - - :note: this configurator depends on 'trajectory' configurator to be configured. - """ - - _default = 1 - - def __init__(self, name, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str. - """ - - IntegerConfigurator.__init__(self, name, **kwargs) - - def configure(self, value): - """ - Configure the input interpolation order. - - :param value: the interpolation order to be configured. - :type value: str one of *'no interpolation'*,*'1st order'*,*'2nd order'*,*'3rd order'*,*'4th order'* or *'5th order'*. - """ - - if not value: - value = self._default - - IntegerConfigurator.configure(self, value) - - if value == 0: - trajConfig = self._configurable[self._dependencies["trajectory"]] - - if not "velocities" in trajConfig["instance"].variables(): - self.error_status = f"the trajectory does not contain any velocities. Use an interpolation order higher than 0" - return - - self["variable"] = "velocities" - - else: - self["variable"] = "coordinates" - self.error_status = "OK" +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError +from MDANSE.Framework.Configurators.IntegerConfigurator import IntegerConfigurator + + +class InterpolationOrderConfigurator(IntegerConfigurator): + """ + This configurator allows to input the interpolation order to be applied when deriving velocities from atomic coordinates. + + The allowed value are *'no interpolation'*,*'1st order'*,*'2nd order'*,*'3rd order'*,*'4th order'* or *'5th order'*, the + former one will not interpolate the velocities from atomic coordinates but will directly use the velocities stored in the trajectory file. + + :attention: it is of paramount importance for the trajectory to be sampled with a very low time \ + step to get accurate velocities interpolated from atomic coordinates. + + :note: this configurator depends on 'trajectory' configurator to be configured. + """ + + _default = 1 + + def __init__(self, name, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str. + """ + + IntegerConfigurator.__init__(self, name, **kwargs) + + def configure(self, value): + """ + Configure the input interpolation order. + + :param value: the interpolation order to be configured. + :type value: str one of *'no interpolation'*,*'1st order'*,*'2nd order'*,*'3rd order'*,*'4th order'* or *'5th order'*. + """ + + if not value: + value = self._default + + IntegerConfigurator.configure(self, value) + + if value == 0: + trajConfig = self._configurable[self._dependencies["trajectory"]] + + if not "velocities" in trajConfig["instance"].variables(): + self.error_status = f"the trajectory does not contain any velocities. Use an interpolation order higher than 0" + return + + self["variable"] = "velocities" + + else: + self["variable"] = "coordinates" + self.error_status = "OK" diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py index 0645f48f48..c2d16feb1b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Configurators/MDFileConfigurator.py -# @brief Implements module/class/test MDFileConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import itertools import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py index 9efded4055..4cd90bd1b7 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Configurators/MDMCTrajectoryConfigurator.py -# @brief A way to take in a trajectory from MDMC in a wrapper +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py index 1d798f5787..dd41e71d4a 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Configurators/McStasInstrumentConfigurator.py -# @brief Implements module/class/test McStasInstrumentConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py index 1648ee58c9..810e718660 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py @@ -1,109 +1,113 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/McStasOptionsConfigurator.py -# @brief Implements module/class/test McStasOptionsConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os -import tempfile -import time -from typing import Dict, Any - -from MDANSE import PLATFORM -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -def parse_dictionary(input: str) -> Dict[str, Any]: - big_line = input.strip("\{\}[] \n") - tokens = big_line.split(",") - result = {} - for entry in tokens: - temp = entry.split(":") - key, value = temp[0], ":".join(temp[1:]) - key = key.strip("' ") - value = value.strip(" '") - try: - value = int(value) - except: - try: - value = float(value) - except: - pass - result[key] = value - return result - - -class McStasOptionsConfigurator(IConfigurator): - """ - This configurator allows to input the McStas options that will be used to run a McStas executable file. - """ - - _default = { - "ncount": 10000, - "dir": os.path.join( - tempfile.gettempdir(), - "mcstas_output", - time.strftime("%d.%m.%Y-%H:%M:%S", time.localtime()), - ), - } - - def configure(self, value): - """ - Configure the McStas options. - - :param configuration: the current configuration. - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the McStas options. - :type value: dict - """ - - options = self._default.copy() - - parsed = parse_dictionary(value) - - for k, v in list(parsed.items()): - if k not in options: - continue - options[k] = v - - tmp = [""] - for k, v in list(options.items()): - if k == "dir": - # If the output directory already exists, defines a 'unique' output directory name because otherwise McStas throws. - if os.path.exists(v): - v = self._default["dir"] - self["mcstas_output_directory"] = v - tmp.append("--%s=%s" % (k, v)) - - dirname = os.path.dirname(self["mcstas_output_directory"]) - - try: - PLATFORM.create_directory(dirname) - except: - self.error_status = f"The directory {dirname} is not writable" - return - - self["value"] = tmp - self.error_status = "OK" - - def get_information(self): - """ - Returns the McStas options as they would be input when using McStas in command line mode. - - :return: the McStas command-line options. - :rtype: str - """ - - return "McStas command line options: %s\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os +import tempfile +import time +from typing import Dict, Any + +from MDANSE import PLATFORM +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +def parse_dictionary(input: str) -> Dict[str, Any]: + big_line = input.strip("\{\}[] \n") + tokens = big_line.split(",") + result = {} + for entry in tokens: + temp = entry.split(":") + key, value = temp[0], ":".join(temp[1:]) + key = key.strip("' ") + value = value.strip(" '") + try: + value = int(value) + except: + try: + value = float(value) + except: + pass + result[key] = value + return result + + +class McStasOptionsConfigurator(IConfigurator): + """ + This configurator allows to input the McStas options that will be used to run a McStas executable file. + """ + + _default = { + "ncount": 10000, + "dir": os.path.join( + tempfile.gettempdir(), + "mcstas_output", + time.strftime("%d.%m.%Y-%H:%M:%S", time.localtime()), + ), + } + + def configure(self, value): + """ + Configure the McStas options. + + :param configuration: the current configuration. + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the McStas options. + :type value: dict + """ + + options = self._default.copy() + + parsed = parse_dictionary(value) + + for k, v in list(parsed.items()): + if k not in options: + continue + options[k] = v + + tmp = [""] + for k, v in list(options.items()): + if k == "dir": + # If the output directory already exists, defines a 'unique' output directory name because otherwise McStas throws. + if os.path.exists(v): + v = self._default["dir"] + self["mcstas_output_directory"] = v + tmp.append("--%s=%s" % (k, v)) + + dirname = os.path.dirname(self["mcstas_output_directory"]) + + try: + PLATFORM.create_directory(dirname) + except: + self.error_status = f"The directory {dirname} is not writable" + return + + self["value"] = tmp + self.error_status = "OK" + + def get_information(self): + """ + Returns the McStas options as they would be input when using McStas in command line mode. + + :return: the McStas command-line options. + :rtype: str + """ + + return "McStas command line options: %s\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py index 7a255036e8..654d511594 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py @@ -1,125 +1,129 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/McStasParametersConfigurator.py -# @brief Implements module/class/test McStasParametersConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os -import re -import subprocess - -from MDANSE import PLATFORM -from MDANSE.Framework.Configurators.IConfigurator import IConfigurator -from MDANSE.Framework.Configurators.McStasOptionsConfigurator import parse_dictionary - - -class McStasParametersConfigurator(IConfigurator): - """ - This configurator allows to input the McStas instrument parameters that will be used to run a McStas executable file. - """ - - _mcStasTypes = {"double": float, "int": int, "string": str} - - _default = { - "beam_wavelength_Angs": 2.0, - "environment_thickness_m": 0.002, - "beam_resolution_meV": 0.1, - "container": "INPUT_FILENAME.laz", - "container_thickness_m": 5e-05, - "sample_height_m": 0.05, - "environment": "INPUT_FILENAME.laz", - "environment_radius_m": 0.025, - "sample_thickness_m": 0.001, - "sample_detector_distance_m": 4.0, - "sample_width_m": 0.02, - "sample_rotation_deg": 45.0, - "detector_height_m": 3.0, - } - - def __init__(self, name, exclude=None, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param exclude: the parameters that exclude when building the McStas instrument parameters list. - :type exclude: list of str - """ - - # The base class constructor. - IConfigurator.__init__(self, name, **kwargs) - - self._exclude = exclude if exclude is not None else [] - - def configure(self, value): - """ - Configure the McStas instrument parameters command line. - - :param configuration: the current configuration. - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the McStas instrument parameters. - :type value: dict - """ - - instrConfig = self._configurable[self._dependencies["instrument"]] - - exePath = instrConfig["value"] - - s = subprocess.Popen( - [exePath, "-h"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT - ) - - parameters_bytes = s.communicate()[0] - parameters_string = parameters_bytes.decode(encoding="utf-8") - - instrParameters = dict( - [ - (v[0], [v[1], v[2]]) - for v in re.findall( - "\s*(\w+)\s*\((\w+)\)\s*\[default='(\S+)'\]", parameters_string - ) - if v[0] not in self._exclude - ] - ) - - val = {} - parsed = parse_dictionary(value) - print(f"Parsed input: {parsed}") - print(f"Received from McStas: {instrParameters}") - for k, v in list(parsed.items()): - if k not in instrParameters: - # instrParameters.pop(k) # how was that supposed to work? - continue - val[k] = self._mcStasTypes[instrParameters[k][0]](v) - - self["value"] = ["%s=%s" % (k, v) for k, v in list(val.items())] - - @property - def exclude(self): - """ - Returns the McStas instrument parameters to exclude from the McStas command-line. - - :return: the McStas instrument parameters to exclude from the McStas command-line. - :rtype: list of str - """ - - return self._exclude - - def get_information(self): - """ - Returns the McStas parameters as they would be input when using McStas in command line mode. - - :return: the McStas command-line parameters. - :rtype: str - """ - - return "McStas command line parameters:%s\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os +import re +import subprocess + +from MDANSE import PLATFORM +from MDANSE.Framework.Configurators.IConfigurator import IConfigurator +from MDANSE.Framework.Configurators.McStasOptionsConfigurator import parse_dictionary + + +class McStasParametersConfigurator(IConfigurator): + """ + This configurator allows to input the McStas instrument parameters that will be used to run a McStas executable file. + """ + + _mcStasTypes = {"double": float, "int": int, "string": str} + + _default = { + "beam_wavelength_Angs": 2.0, + "environment_thickness_m": 0.002, + "beam_resolution_meV": 0.1, + "container": "INPUT_FILENAME.laz", + "container_thickness_m": 5e-05, + "sample_height_m": 0.05, + "environment": "INPUT_FILENAME.laz", + "environment_radius_m": 0.025, + "sample_thickness_m": 0.001, + "sample_detector_distance_m": 4.0, + "sample_width_m": 0.02, + "sample_rotation_deg": 45.0, + "detector_height_m": 3.0, + } + + def __init__(self, name, exclude=None, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param exclude: the parameters that exclude when building the McStas instrument parameters list. + :type exclude: list of str + """ + + # The base class constructor. + IConfigurator.__init__(self, name, **kwargs) + + self._exclude = exclude if exclude is not None else [] + + def configure(self, value): + """ + Configure the McStas instrument parameters command line. + + :param configuration: the current configuration. + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the McStas instrument parameters. + :type value: dict + """ + + instrConfig = self._configurable[self._dependencies["instrument"]] + + exePath = instrConfig["value"] + + s = subprocess.Popen( + [exePath, "-h"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT + ) + + parameters_bytes = s.communicate()[0] + parameters_string = parameters_bytes.decode(encoding="utf-8") + + instrParameters = dict( + [ + (v[0], [v[1], v[2]]) + for v in re.findall( + "\s*(\w+)\s*\((\w+)\)\s*\[default='(\S+)'\]", parameters_string + ) + if v[0] not in self._exclude + ] + ) + + val = {} + parsed = parse_dictionary(value) + print(f"Parsed input: {parsed}") + print(f"Received from McStas: {instrParameters}") + for k, v in list(parsed.items()): + if k not in instrParameters: + # instrParameters.pop(k) # how was that supposed to work? + continue + val[k] = self._mcStasTypes[instrParameters[k][0]](v) + + self["value"] = ["%s=%s" % (k, v) for k, v in list(val.items())] + + @property + def exclude(self): + """ + Returns the McStas instrument parameters to exclude from the McStas command-line. + + :return: the McStas instrument parameters to exclude from the McStas command-line. + :rtype: list of str + """ + + return self._exclude + + def get_information(self): + """ + Returns the McStas parameters as they would be input when using McStas in command line mode. + + :return: the McStas command-line parameters. + :rtype: str + """ + + return "McStas command line parameters:%s\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py index 858ca25ccd..746935943f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Configurators/MDMCTrajectoryConfigurator.py -# @brief A way to take in a trajectory from MDMC in a wrapper +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py index 37f6da0454..49043b6421 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py @@ -1,105 +1,109 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/MultipleChoicesConfigurator.py -# @brief Implements module/class/test MultipleChoicesConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class MultipleChoicesConfigurator(IConfigurator): - """ - This Configurator allows to select several items among multiple choices. - - :attention: all the selected items must belong to the allowed selection list. - """ - - _default = [] - - def __init__(self, name, choices=None, nChoices=None, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param choices: the list of values allowed for selection. - :type choices: list - :param nChoices: the maximum number of values that can be selected or None if there is no restriction on this number. - :type nChoices: int or None - """ - - IConfigurator.__init__(self, name, **kwargs) - - self._choices = choices - - self._nChoices = nChoices - - def configure(self, value): - """ - Configure the input selection list. - - :param configuration: the current configuration - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the input selection list. - :type value: list - """ - - if self._nChoices is not None: - if len(value) != self._nChoices: - self.error_status = f"invalid number of choices." - return - - indexes = [] - for v in value: - try: - indexes.append(self._choices.index(v)) - except ValueError: - self.error_status = f"{v} item is not a valid choice" - return - - if not indexes: - self.error_status = "Empty choices selection." - return - - self["indexes"] = indexes - self["choices"] = [self._choices[i] for i in indexes] - self["value"] = self["choices"] - self.error_status = "OK" - - @property - def choices(self): - """ - Returns the list of allowed selection items. - - :return: the list of allowed selection items. - :rtype: list - """ - - return self._choices - - @property - def nChoices(self): - """ - Returns the maximum number items that can be selected or None if there is no restriction on this number. - - :return: the maximum number items that can be selected. - :rtype: int or None - """ - - return self._nChoices - - def get_information(self): - return "Selected items: %r\n" % self["choices"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class MultipleChoicesConfigurator(IConfigurator): + """ + This Configurator allows to select several items among multiple choices. + + :attention: all the selected items must belong to the allowed selection list. + """ + + _default = [] + + def __init__(self, name, choices=None, nChoices=None, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param choices: the list of values allowed for selection. + :type choices: list + :param nChoices: the maximum number of values that can be selected or None if there is no restriction on this number. + :type nChoices: int or None + """ + + IConfigurator.__init__(self, name, **kwargs) + + self._choices = choices + + self._nChoices = nChoices + + def configure(self, value): + """ + Configure the input selection list. + + :param configuration: the current configuration + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the input selection list. + :type value: list + """ + + if self._nChoices is not None: + if len(value) != self._nChoices: + self.error_status = f"invalid number of choices." + return + + indexes = [] + for v in value: + try: + indexes.append(self._choices.index(v)) + except ValueError: + self.error_status = f"{v} item is not a valid choice" + return + + if not indexes: + self.error_status = "Empty choices selection." + return + + self["indexes"] = indexes + self["choices"] = [self._choices[i] for i in indexes] + self["value"] = self["choices"] + self.error_status = "OK" + + @property + def choices(self): + """ + Returns the list of allowed selection items. + + :return: the list of allowed selection items. + :rtype: list + """ + + return self._choices + + @property + def nChoices(self): + """ + Returns the maximum number items that can be selected or None if there is no restriction on this number. + + :return: the maximum number items that can be selected. + :rtype: int or None + """ + + return self._nChoices + + def get_information(self): + return "Selected items: %r\n" % self["choices"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py index c6ace54075..79d94cfe1c 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py @@ -1,74 +1,78 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/OutputDirectoryConfigurator.py -# @brief Implements module/class/test OutputDirectoryConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os - -from MDANSE import PLATFORM -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class OutputDirectoryConfigurator(IConfigurator): - """ - This Configurator allows to set an output directory. - """ - - _default = os.getcwd() - - def __init__(self, name, new=False, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param new: if True the output directory path will be checked for being new. - :type new: bool - """ - - IConfigurator.__init__(self, name, **kwargs) - - self._new = new - - def configure(self, value): - """ - Configure an output directory. - - :param configuration: the current configuration. - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the path for the output directory. - :type value: str - """ - - value = PLATFORM.get_path(value) - - if self._new: - if os.path.exists(value): - self.error_status = "the output directory must not exist" - return - - self["value"] = value - self.error_status = "OK" - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - return "Output directory: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os + +from MDANSE import PLATFORM +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class OutputDirectoryConfigurator(IConfigurator): + """ + This Configurator allows to set an output directory. + """ + + _default = os.getcwd() + + def __init__(self, name, new=False, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param new: if True the output directory path will be checked for being new. + :type new: bool + """ + + IConfigurator.__init__(self, name, **kwargs) + + self._new = new + + def configure(self, value): + """ + Configure an output directory. + + :param configuration: the current configuration. + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the path for the output directory. + :type value: str + """ + + value = PLATFORM.get_path(value) + + if self._new: + if os.path.exists(value): + self.error_status = "the output directory must not exist" + return + + self["value"] = value + self.error_status = "OK" + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + return "Output directory: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py index 04080cdb3f..c575494b84 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py @@ -1,137 +1,141 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/OutputFilesConfigurator.py -# @brief Implements module/class/test OutputFilesConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os -import tempfile - -from MDANSE import PLATFORM -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) -from MDANSE.Framework.Formats.IFormat import IFormat - - -class OutputFilesConfigurator(IConfigurator): - """ - This configurator allows to define the output directory, the basename, and the format(s) of the output file(s) - resulting from an analysis. - - Once configured, this configurator will provide a list of files built by joining the given output directory, the - basename and the extensions corresponding to the input file formats. - - For analysis, MDANSE currently supports only the HDF and Text formats. To define a new output file format - for an analysis, you must inherit from MDANSE.Framework.Formats.IFormat.IFormat interface. - """ - - _default = ("OUTPUT_FILENAME", ["HDFFormat"]) - _label = "Output filename and formats (filename, [format, ...])" - - def __init__(self, name, formats=None, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param formats: the list of output file formats supported. - :type formats: list of str - """ - - IConfigurator.__init__(self, name, **kwargs) - - self._formats = ( - formats if formats is not None else OutputFilesConfigurator._default[-1] - ) - - def configure(self, value): - """ - Configure a set of output files for an analysis. - - :param value: the output files specifications. Must be a 3-tuple whose 1st element \ - is the output directory, 2nd element the basename and 3rd element a list of file formats. - :type value: 3-tuple - """ - - root, formats = value - - if not root: - self.error_status = "empty root name for the output file." - return - - dirname = os.path.dirname(root) - - try: - PLATFORM.create_directory(dirname) - except: - self.error_status = f"the directory {dirname} is not writable" - return - - if not formats: - self.error_status = f"no output formats specified" - return - - for fmt in formats: - if not fmt in self._formats: - self.error_status = ( - f"the output file format {fmt} is not a valid output format" - ) - return - - if fmt not in IFormat.subclasses(): - self.error_status = f"the output file format {fmt} is not registered as a valid file format." - return - - self["root"] = root - self["formats"] = formats - self["files"] = ["%s%s" % (root, IFormat.create(f).extension) for f in formats] - - self["value"] = self["files"] - self.error_status = "OK" - - @property - def formats(self): - """ - Returns the list of output file formats supported. - - :return: the list of file formats supported. - :rtype: list of str - """ - return self._formats - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - info = ["Input files:\n"] - for f in self["files"]: - info.append(f) - info.append("\n") - - return "".join(info) - - @property - def default(self) -> tuple[str, list[str]]: - """ - - Returns - ------- - tuple[str, str] - A tuple of the default filename and format. - """ - return self._default[0], self.formats +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os +import tempfile + +from MDANSE import PLATFORM +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) +from MDANSE.Framework.Formats.IFormat import IFormat + + +class OutputFilesConfigurator(IConfigurator): + """ + This configurator allows to define the output directory, the basename, and the format(s) of the output file(s) + resulting from an analysis. + + Once configured, this configurator will provide a list of files built by joining the given output directory, the + basename and the extensions corresponding to the input file formats. + + For analysis, MDANSE currently supports only the HDF and Text formats. To define a new output file format + for an analysis, you must inherit from MDANSE.Framework.Formats.IFormat.IFormat interface. + """ + + _default = ("OUTPUT_FILENAME", ["HDFFormat"]) + _label = "Output filename and formats (filename, [format, ...])" + + def __init__(self, name, formats=None, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param formats: the list of output file formats supported. + :type formats: list of str + """ + + IConfigurator.__init__(self, name, **kwargs) + + self._formats = ( + formats if formats is not None else OutputFilesConfigurator._default[-1] + ) + + def configure(self, value): + """ + Configure a set of output files for an analysis. + + :param value: the output files specifications. Must be a 3-tuple whose 1st element \ + is the output directory, 2nd element the basename and 3rd element a list of file formats. + :type value: 3-tuple + """ + + root, formats = value + + if not root: + self.error_status = "empty root name for the output file." + return + + dirname = os.path.dirname(root) + + try: + PLATFORM.create_directory(dirname) + except: + self.error_status = f"the directory {dirname} is not writable" + return + + if not formats: + self.error_status = f"no output formats specified" + return + + for fmt in formats: + if not fmt in self._formats: + self.error_status = ( + f"the output file format {fmt} is not a valid output format" + ) + return + + if fmt not in IFormat.subclasses(): + self.error_status = f"the output file format {fmt} is not registered as a valid file format." + return + + self["root"] = root + self["formats"] = formats + self["files"] = ["%s%s" % (root, IFormat.create(f).extension) for f in formats] + + self["value"] = self["files"] + self.error_status = "OK" + + @property + def formats(self): + """ + Returns the list of output file formats supported. + + :return: the list of file formats supported. + :rtype: list of str + """ + return self._formats + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + info = ["Input files:\n"] + for f in self["files"]: + info.append(f) + info.append("\n") + + return "".join(info) + + @property + def default(self) -> tuple[str, list[str]]: + """ + + Returns + ------- + tuple[str, str] + A tuple of the default filename and format. + """ + return self._default[0], self.formats diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py index d8adfdb577..bf98c46386 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Configurators/OutputFilesConfigurator.py -# @brief Implements module/class/test OutputFilesConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py index 128070deef..7418a3c907 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py @@ -1,90 +1,94 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/PartialChargeConfigurator.py -# @brief Implements module/class/test PartialChargeConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) -from MDANSE.Framework.UserDefinitionStore import UD_STORE - - -class PartialChargeConfigurator(IConfigurator): - """ - This configurator allows to input partial charges. - """ - - _default = "" - - def configure(self, value): - """ - Configure a python script. - - :param value: the path for the python script. - :type value: str - """ - - trajConfig = self._configurable[self._dependencies["trajectory"]] - - if UD_STORE.has_definition(trajConfig["basename"], "partial_charges", value): - self.update( - UD_STORE.get_definition( - trajConfig["basename"], "partial_charges", value - ) - ) - else: - if isinstance(value, str): - # Case of a python script - if os.path.exists(value): - namespace = {} - - exec( - compile(open(value, "rb").read(), value, "exec"), - self.__dict__, - namespace, - ) - - if "charges" not in namespace: - self.error_status = ( - f"The variable 'charges' is not defined in" - f"the {value} python script file" - ) - return - - self.update(namespace) - else: - self.error_status = f"The python script defining partial charges {value} could not be found." - return - - elif isinstance(value, dict): - self["charges"] = value - else: - self.error_status = f"Invalid type for partial charges." - return - self.error_status = "OK" - - def get_information(self): - """ - Returns some basic informations about the partial charges. - - :return: the informations about the partial charges. - :rtype: str - """ - - info = "Sum of partial charges = %8.3f\n" % sum(self["charges"].values()) - - return info +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) +from MDANSE.Framework.UserDefinitionStore import UD_STORE + + +class PartialChargeConfigurator(IConfigurator): + """ + This configurator allows to input partial charges. + """ + + _default = "" + + def configure(self, value): + """ + Configure a python script. + + :param value: the path for the python script. + :type value: str + """ + + trajConfig = self._configurable[self._dependencies["trajectory"]] + + if UD_STORE.has_definition(trajConfig["basename"], "partial_charges", value): + self.update( + UD_STORE.get_definition( + trajConfig["basename"], "partial_charges", value + ) + ) + else: + if isinstance(value, str): + # Case of a python script + if os.path.exists(value): + namespace = {} + + exec( + compile(open(value, "rb").read(), value, "exec"), + self.__dict__, + namespace, + ) + + if "charges" not in namespace: + self.error_status = ( + f"The variable 'charges' is not defined in" + f"the {value} python script file" + ) + return + + self.update(namespace) + else: + self.error_status = f"The python script defining partial charges {value} could not be found." + return + + elif isinstance(value, dict): + self["charges"] = value + else: + self.error_status = f"Invalid type for partial charges." + return + self.error_status = "OK" + + def get_information(self): + """ + Returns some basic informations about the partial charges. + + :return: the informations about the partial charges. + :rtype: str + """ + + info = "Sum of partial charges = %8.3f\n" % sum(self["charges"].values()) + + return info diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py index 001b045def..8fa5656b7b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py @@ -1,86 +1,90 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/ProjectionConfigurator.py -# @brief Implements module/class/test ProjectionConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) -from MDANSE.Framework.Projectors.IProjector import IProjector -from MDANSE.Framework.Projectors.IProjector import ProjectorError - - -class ProjectionConfigurator(IConfigurator): - """ - This configurator allows to define a projector for atomic coordinates. - - Planar and axial projections are supported by MDANSE while a null projector, that does not project the coordinates, has been introduced - in MDANSE.Framework.Projectors.IProjector.IProjector for the sake of homogeneity. - """ - - _default = None - - def configure(self, value): - """ - Configure a projector. - - :param value: the input projector definition. It can be a 2-tuple whose 1st element if the name \ - of the projector (one of *'null'*,*'axial'* or *'planar'*) and the 2nd element the parameters for the selected \ - projector (None for *'null'*, a Scientific.Vector for *'axial'* and a list of two Scientific.Vector for *'planar'*) \ - or ``None`` in the case where no projection is needed. - :type value: 2-tuple - """ - self["axis"] = None - - if value is None: - value = ("NullProjector", None) - - try: - mode, axis = value - except (TypeError, ValueError) as e: - self.error_status = "Failed to unpack input" + str(e) - return - - if not isinstance(mode, str): - self.error_status = "invalid type for projection mode: must be a string" - return - - try: - self["projector"] = IProjector.create(mode) - except KeyError: - self.error_status = f"the projector {mode} is unknown" - return - else: - try: - self["projector"].set_axis(axis) - except ProjectorError: - self.error_status = f"Axis {axis} is wrong for this projector" - return - else: - self["axis"] = self["projector"].axis - self.error_status = "OK" - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - if self["axis"] is not None: - return "No projection performed\n" - else: - return "Projection along %r axis\n" % self["axis"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) +from MDANSE.Framework.Projectors.IProjector import IProjector +from MDANSE.Framework.Projectors.IProjector import ProjectorError + + +class ProjectionConfigurator(IConfigurator): + """ + This configurator allows to define a projector for atomic coordinates. + + Planar and axial projections are supported by MDANSE while a null projector, that does not project the coordinates, has been introduced + in MDANSE.Framework.Projectors.IProjector.IProjector for the sake of homogeneity. + """ + + _default = None + + def configure(self, value): + """ + Configure a projector. + + :param value: the input projector definition. It can be a 2-tuple whose 1st element if the name \ + of the projector (one of *'null'*,*'axial'* or *'planar'*) and the 2nd element the parameters for the selected \ + projector (None for *'null'*, a Scientific.Vector for *'axial'* and a list of two Scientific.Vector for *'planar'*) \ + or ``None`` in the case where no projection is needed. + :type value: 2-tuple + """ + self["axis"] = None + + if value is None: + value = ("NullProjector", None) + + try: + mode, axis = value + except (TypeError, ValueError) as e: + self.error_status = "Failed to unpack input" + str(e) + return + + if not isinstance(mode, str): + self.error_status = "invalid type for projection mode: must be a string" + return + + try: + self["projector"] = IProjector.create(mode) + except KeyError: + self.error_status = f"the projector {mode} is unknown" + return + else: + try: + self["projector"].set_axis(axis) + except ProjectorError: + self.error_status = f"Axis {axis} is wrong for this projector" + return + else: + self["axis"] = self["projector"].axis + self.error_status = "OK" + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + if self["axis"] is not None: + return "No projection performed\n" + else: + return "Projection along %r axis\n" % self["axis"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py index 31eeee4f7a..9994660bf4 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py @@ -1,61 +1,65 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/PythonObjectConfigurator.py -# @brief Implements module/class/test PythonObjectConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import ast - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class PythonObjectConfigurator(IConfigurator): - """ - This Configurator allows to input and evaluate basic python object. - - The python object supported are strings, numbers, tuples, lists, dicts, booleans and None type. - - :note: this configurator is based on a literal and safe evaluation of the input using ast standard library module. - """ - - _default = '""' - - def configure(self, value): - """ - Configure a python object. - - :param value: the python object to be configured and evaluated. - :type value: strings, numbers, tuples, lists, dicts, booleans or None type. - """ - - try: - value = ast.literal_eval(repr(value)) - except SyntaxError as e: - self.error_status = f"python code SyntaxError: {e}" - return - - self["value"] = value - self.error_status = "OK" - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - return "Python object: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import ast + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class PythonObjectConfigurator(IConfigurator): + """ + This Configurator allows to input and evaluate basic python object. + + The python object supported are strings, numbers, tuples, lists, dicts, booleans and None type. + + :note: this configurator is based on a literal and safe evaluation of the input using ast standard library module. + """ + + _default = '""' + + def configure(self, value): + """ + Configure a python object. + + :param value: the python object to be configured and evaluated. + :type value: strings, numbers, tuples, lists, dicts, booleans or None type. + """ + + try: + value = ast.literal_eval(repr(value)) + except SyntaxError as e: + self.error_status = f"python code SyntaxError: {e}" + return + + self["value"] = value + self.error_status = "OK" + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + return "Python object: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py index 5b9bcee8b5..1365621432 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py @@ -1,78 +1,82 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/PythonScriptConfigurator.py -# @brief Implements module/class/test PythonScriptConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError -from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator - - -class PythonScriptConfigurator(InputFileConfigurator): - """ - This configurator allows to input a Python script. - """ - - _default = "" - - def __init__(self, name, variables=None, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param variables: the list of HDF variables that must be present in the input HDF file or None if there is no compulsory variable. - :type variables: list of str or None - """ - - # The base class constructor. - InputFileConfigurator.__init__(self, name, **kwargs) - - self._variables = variables if variables is not None else [] - - def configure(self, value): - """ - Configure a python script. - - :param configuration: the current configuration. - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the path for the python script. - :type value: str - """ - - InputFileConfigurator.configure(self, value) - - namespace = {} - - exec(compile(open(value, "rb").read(), value, "exec"), self.__dict__, namespace) - - for v in self._variables: - if v not in namespace: - self.error_status = ( - f"The variable {v} is not defined in the {value} python script file" - ) - return - - self.update(namespace) - self.error_status = "OK" - - @property - def variables(self): - """ - Returns the list of HDF variables that must be present in the HDF file. - - :return: the list of HDF variables that must be present in the HDF file. - :rtype: list of str - """ - - return self._variables +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError +from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator + + +class PythonScriptConfigurator(InputFileConfigurator): + """ + This configurator allows to input a Python script. + """ + + _default = "" + + def __init__(self, name, variables=None, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param variables: the list of HDF variables that must be present in the input HDF file or None if there is no compulsory variable. + :type variables: list of str or None + """ + + # The base class constructor. + InputFileConfigurator.__init__(self, name, **kwargs) + + self._variables = variables if variables is not None else [] + + def configure(self, value): + """ + Configure a python script. + + :param configuration: the current configuration. + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the path for the python script. + :type value: str + """ + + InputFileConfigurator.configure(self, value) + + namespace = {} + + exec(compile(open(value, "rb").read(), value, "exec"), self.__dict__, namespace) + + for v in self._variables: + if v not in namespace: + self.error_status = ( + f"The variable {v} is not defined in the {value} python script file" + ) + return + + self.update(namespace) + self.error_status = "OK" + + @property + def variables(self): + """ + Returns the list of HDF variables that must be present in the HDF file. + + :return: the list of HDF variables that must be present in the HDF file. + :rtype: list of str + """ + + return self._variables diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py index 014e5c892e..88deea4ad4 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py @@ -1,116 +1,120 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/QVectorsConfigurator.py -# @brief Implements module/class/test QVectorsConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.UserDefinitionStore import UD_STORE -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) -from MDANSE.Framework.QVectors.IQVectors import IQVectors - - -class QVectorsConfigurator(IConfigurator): - """ - This Configurator allows to set reciprocal vectors. - - Reciprocal vectors are used in MDANSE for the analysis related to scattering experiments such as dynamic coherent structure - or elastic incoherent structure factor analysis. In MDANSE, properties that depends on Q vectors are always scalar regarding - Q vectors in the sense that the values of these properties will be computed for a given norm of Q vectors and not for a given Q vectors. - Hence, the Q vectors generator supported by MDANSE always generates Q vectors on Q-shells, each shell containing a set of Q vectors whose - norm match the Q shell value within a given tolerance. - - Depending on the generator selected, Q vectors can be generated isotropically or anistropically, on a lattice or randomly. - - Q vectors can be saved to a user definition and, as such, can be further reused in another MDANSE session. - - To define a new Q vectors generator, you must inherit from MDANSE.Framework.QVectors.QVectors.QVector interface. - - :note: this configurator depends on 'trajectory' configurator to be configured. - """ - - _default = ( - "SphericalLatticeQVectors", - {"shells": (0.1, 5, 0.1), "width": 0.1, "n_vectors": 50, "seed": 0}, - ) - - def configure(self, value): - """ - Configure a Q vectors generator. - - :param configuration: the current configuration. - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the Q vectors generator definition. It can be a 2-tuple, whose 1st element is the name of the Q vector generator \ - and 2nd element the parameters for this configurator or a string that matches a Q vectors user definition. - :type value: 2-tuple or str - """ - - trajConfig = self._configurable[self._dependencies["trajectory"]] - if isinstance(value, str): - if UD_STORE.has_definition(trajConfig["basename"], "q_vectors", value): - ud = UD_STORE.get_definition(trajConfig["basename"], "q_vectors", value) - self["parameters"] = ud["parameters"] - self["type"] = ud["generator"] - self["is_lattice"] = ud["is_lattice"] - self["q_vectors"] = ud["q_vectors"] - else: - self.error_status = ( - f"Q vectors user definition {value} is not stored on this machine" - ) - return - - else: - if isinstance(value, tuple): - try: - generator, parameters = value - except ValueError: - self.error_status = f"Invalid q vectors settings {value}" - return - generator = IQVectors.create( - generator, trajConfig["instance"].chemical_system - ) - generator.setup(parameters) - generator.generate() - - if not generator.configuration["q_vectors"]: - self.error_status = "no Q vectors could be generated" - return - - self["parameters"] = parameters - # self["type"] = generator._type - self["is_lattice"] = generator.is_lattice - self["q_vectors"] = generator.configuration["q_vectors"] - else: - self.error_status = "Q vectors setting must be a tuple {value}" - return - - self["shells"] = list(self["q_vectors"].keys()) - self["n_shells"] = len(self["q_vectors"]) - self["value"] = self["q_vectors"] - self.error_status = "OK" - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - info = ["%d Q shells generated\n" % self["n_shells"]] - for qValue, qVectors in list(self["q_vectors"].items()): - info.append("Shell %s: %d Q vectors generated\n" % (qValue, len(qVectors))) - - return "".join(info) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.UserDefinitionStore import UD_STORE +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) +from MDANSE.Framework.QVectors.IQVectors import IQVectors + + +class QVectorsConfigurator(IConfigurator): + """ + This Configurator allows to set reciprocal vectors. + + Reciprocal vectors are used in MDANSE for the analysis related to scattering experiments such as dynamic coherent structure + or elastic incoherent structure factor analysis. In MDANSE, properties that depends on Q vectors are always scalar regarding + Q vectors in the sense that the values of these properties will be computed for a given norm of Q vectors and not for a given Q vectors. + Hence, the Q vectors generator supported by MDANSE always generates Q vectors on Q-shells, each shell containing a set of Q vectors whose + norm match the Q shell value within a given tolerance. + + Depending on the generator selected, Q vectors can be generated isotropically or anistropically, on a lattice or randomly. + + Q vectors can be saved to a user definition and, as such, can be further reused in another MDANSE session. + + To define a new Q vectors generator, you must inherit from MDANSE.Framework.QVectors.QVectors.QVector interface. + + :note: this configurator depends on 'trajectory' configurator to be configured. + """ + + _default = ( + "SphericalLatticeQVectors", + {"shells": (0.1, 5, 0.1), "width": 0.1, "n_vectors": 50, "seed": 0}, + ) + + def configure(self, value): + """ + Configure a Q vectors generator. + + :param configuration: the current configuration. + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the Q vectors generator definition. It can be a 2-tuple, whose 1st element is the name of the Q vector generator \ + and 2nd element the parameters for this configurator or a string that matches a Q vectors user definition. + :type value: 2-tuple or str + """ + + trajConfig = self._configurable[self._dependencies["trajectory"]] + if isinstance(value, str): + if UD_STORE.has_definition(trajConfig["basename"], "q_vectors", value): + ud = UD_STORE.get_definition(trajConfig["basename"], "q_vectors", value) + self["parameters"] = ud["parameters"] + self["type"] = ud["generator"] + self["is_lattice"] = ud["is_lattice"] + self["q_vectors"] = ud["q_vectors"] + else: + self.error_status = ( + f"Q vectors user definition {value} is not stored on this machine" + ) + return + + else: + if isinstance(value, tuple): + try: + generator, parameters = value + except ValueError: + self.error_status = f"Invalid q vectors settings {value}" + return + generator = IQVectors.create( + generator, trajConfig["instance"].chemical_system + ) + generator.setup(parameters) + generator.generate() + + if not generator.configuration["q_vectors"]: + self.error_status = "no Q vectors could be generated" + return + + self["parameters"] = parameters + # self["type"] = generator._type + self["is_lattice"] = generator.is_lattice + self["q_vectors"] = generator.configuration["q_vectors"] + else: + self.error_status = "Q vectors setting must be a tuple {value}" + return + + self["shells"] = list(self["q_vectors"].keys()) + self["n_shells"] = len(self["q_vectors"]) + self["value"] = self["q_vectors"] + self.error_status = "OK" + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + info = ["%d Q shells generated\n" % self["n_shells"]] + for qValue, qVectors in list(self["q_vectors"].items()): + info.append("Shell %s: %d Q vectors generated\n" % (qValue, len(qVectors))) + + return "".join(info) diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py index 33663a9a36..1f8a728cee 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py @@ -1,218 +1,222 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/RangeConfigurator.py -# @brief Implements module/class/test RangeConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import numpy as np - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class RangeConfigurator(IConfigurator): - """ - This configurator allow to input a range of values given 3 parameters : start, stop, step. - - By default the values are generated as a NumPy array. - """ - - _default = (0, 10, 1) - - def __init__( - self, - name, - valueType=int, - includeLast=False, - sort=False, - toList=False, - mini=None, - maxi=None, - **kwargs, - ): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param valueType: the numeric type for the range. - :type valueType: int or float - :param includeLast: if True the last value of the interval will be included (closed interval) otherwise excluded (opened interval). - :type includeLast: bool - :param sort: if True, the values generated will be sorted in increasing order. - :type bool: if True, the values generated will be converted from a NumPy array to a python list. - :param toList: - :type toList: bool - :param mini: if not None, all values generated below mini will be discarded. - :type mini: int, float or None - :param maxi: if not None, all values generated over maxi will be discarded. - :type maxi: int, float or None - """ - - IConfigurator.__init__(self, name, **kwargs) - - self._valueType = valueType - - self._includeLast = includeLast - - self._sort = sort - - self._toList = toList - - self._mini = mini - - self._maxi = maxi - - def configure(self, value): - """ - Configure a range from its first, last and step values. - - :param value: the first, last and step values used to generate the range. - :type value: 3-tuple - """ - - first, last, step = value - - if step == 0: - self.error_status = "Step of a range cannot be 0" - return - - if self._includeLast: - last += step * 0.01 # less likely to overstep the upper limit - - value = np.arange(first, last, step) - # we add additional check if the points are all within limits - value = value[np.where(value >= first)] - if self._includeLast: - value = value[np.where(value <= last)] - else: - value = value[np.where(value < last)] - # end of the range check - value = value.astype(self._valueType) - - if self._mini is not None: - value = value[value >= self._mini] - - if self._maxi is not None: - value = value[value < self._maxi] - - if value.size == 0: - self.error_status = "the input range is empty." - return - - if self._sort: - value = np.sort(value) - - if self._toList: - value = value.tolist() - - self["value"] = value - - self["first"] = self["value"][0] - - self["last"] = self["value"][-1] - - self["number"] = len(self["value"]) - - self["mid_points"] = (value[1:] + value[0:-1]) / 2.0 - - try: - self["step"] = self["value"][1] - self["value"][0] - except IndexError: - self["step"] = 1 - self.error_status = "OK" - - @property - def valueType(self): - """ - Returns the values type of the range. - - :return: the values type of the range. - :rtype: one of int or float - """ - - return self._valueType - - @property - def includeLast(self): - """ - Returns whether or not the range will be closed (True) or opened (False). - - :return: True if the generated range is closed, otherwise False. - :rtype: bool - """ - - return self._includeLast - - @property - def toList(self): - """ - Returns whether or not the range will be generated a Numpy array (True) or python list (False). - - :return: True if the generated range is a python list, otherwise it is a Numpy array. - :rtype: bool - """ - - return self._toList - - @property - def sort(self): - """ - Returns whether or not the generated values will be sorted in increasing order. - - :return: True if the generated values are sorted in in creasing order, False otherwise. - :rtype: bool - """ - - return self._sort - - @property - def mini(self): - """ - Returns the minimum value for the range, None if no limit. - - :return: the minimum value for the range, None if no limit. - :rtype: int or float - """ - - return self._mini - - @property - def maxi(self): - """ - Returns the maximum value for the range, None if no limit. - - :return: the maximum value for the range, None if no limit. - :rtype: int or float - """ - - return self._maxi - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - info = "%d values from %s to %s" % (self["number"], self["first"], self["last"]) - - if self._includeLast: - info += " last value included" - else: - info += " last value excluded" - - return info + "\n" +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import numpy as np + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class RangeConfigurator(IConfigurator): + """ + This configurator allow to input a range of values given 3 parameters : start, stop, step. + + By default the values are generated as a NumPy array. + """ + + _default = (0, 10, 1) + + def __init__( + self, + name, + valueType=int, + includeLast=False, + sort=False, + toList=False, + mini=None, + maxi=None, + **kwargs, + ): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param valueType: the numeric type for the range. + :type valueType: int or float + :param includeLast: if True the last value of the interval will be included (closed interval) otherwise excluded (opened interval). + :type includeLast: bool + :param sort: if True, the values generated will be sorted in increasing order. + :type bool: if True, the values generated will be converted from a NumPy array to a python list. + :param toList: + :type toList: bool + :param mini: if not None, all values generated below mini will be discarded. + :type mini: int, float or None + :param maxi: if not None, all values generated over maxi will be discarded. + :type maxi: int, float or None + """ + + IConfigurator.__init__(self, name, **kwargs) + + self._valueType = valueType + + self._includeLast = includeLast + + self._sort = sort + + self._toList = toList + + self._mini = mini + + self._maxi = maxi + + def configure(self, value): + """ + Configure a range from its first, last and step values. + + :param value: the first, last and step values used to generate the range. + :type value: 3-tuple + """ + + first, last, step = value + + if step == 0: + self.error_status = "Step of a range cannot be 0" + return + + if self._includeLast: + last += step * 0.01 # less likely to overstep the upper limit + + value = np.arange(first, last, step) + # we add additional check if the points are all within limits + value = value[np.where(value >= first)] + if self._includeLast: + value = value[np.where(value <= last)] + else: + value = value[np.where(value < last)] + # end of the range check + value = value.astype(self._valueType) + + if self._mini is not None: + value = value[value >= self._mini] + + if self._maxi is not None: + value = value[value < self._maxi] + + if value.size == 0: + self.error_status = "the input range is empty." + return + + if self._sort: + value = np.sort(value) + + if self._toList: + value = value.tolist() + + self["value"] = value + + self["first"] = self["value"][0] + + self["last"] = self["value"][-1] + + self["number"] = len(self["value"]) + + self["mid_points"] = (value[1:] + value[0:-1]) / 2.0 + + try: + self["step"] = self["value"][1] - self["value"][0] + except IndexError: + self["step"] = 1 + self.error_status = "OK" + + @property + def valueType(self): + """ + Returns the values type of the range. + + :return: the values type of the range. + :rtype: one of int or float + """ + + return self._valueType + + @property + def includeLast(self): + """ + Returns whether or not the range will be closed (True) or opened (False). + + :return: True if the generated range is closed, otherwise False. + :rtype: bool + """ + + return self._includeLast + + @property + def toList(self): + """ + Returns whether or not the range will be generated a Numpy array (True) or python list (False). + + :return: True if the generated range is a python list, otherwise it is a Numpy array. + :rtype: bool + """ + + return self._toList + + @property + def sort(self): + """ + Returns whether or not the generated values will be sorted in increasing order. + + :return: True if the generated values are sorted in in creasing order, False otherwise. + :rtype: bool + """ + + return self._sort + + @property + def mini(self): + """ + Returns the minimum value for the range, None if no limit. + + :return: the minimum value for the range, None if no limit. + :rtype: int or float + """ + + return self._mini + + @property + def maxi(self): + """ + Returns the maximum value for the range, None if no limit. + + :return: the maximum value for the range, None if no limit. + :rtype: int or float + """ + + return self._maxi + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + info = "%d values from %s to %s" % (self["number"], self["first"], self["last"]) + + if self._includeLast: + info += " last value included" + else: + info += " last value excluded" + + return info + "\n" diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py index 6e2d70b167..0ae94b6700 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py @@ -1,85 +1,89 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/RunningModeConfigurator.py -# @brief Implements module/class/test RunningModeConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import os -import multiprocessing - -from MDANSE import PLATFORM -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class RunningModeConfigurator(IConfigurator): - """ - This configurator allows to choose the mode used to run the calculation. - - MDANSE currently support single-core or multicore (SMP) running modes. In the laster case, you have to - specify the number of slots used for running the analysis. - """ - - availablesModes = ["single-core", "threadpool", "multicore"] - - _default = ("single-core", 1) - - def configure(self, value): - """ - Configure the running mode. - - :param value: the running mode specification. It can be *'single-core'* or a 2-tuple whose first element \ - must be *'multicore'* and 2nd element the number of slots allocated for running the analysis. - :type value: *'single-core'* or 2-tuple - """ - - if isinstance(value, str): - mode = value - else: - mode = value[0].lower() - - if not mode in self.availablesModes: - self.error_status = f"{mode} is not a valid running mode." - return - - if mode == "single-core": - slots = 1 - - else: - slots = int(value[1]) - - if mode == "multicore": - maxSlots = multiprocessing.cpu_count() - if slots > maxSlots: - self.error_status = "invalid number of allocated slots." - return - - if slots <= 0: - self.error_status = "invalid number of allocated slots." - return - - self["mode"] = mode - - self["slots"] = slots - self.error_status = "OK" - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - return "Run in %s mode (%d slots)\n" % (self["mode"], self["slots"]) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import os +import multiprocessing + +from MDANSE import PLATFORM +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class RunningModeConfigurator(IConfigurator): + """ + This configurator allows to choose the mode used to run the calculation. + + MDANSE currently support single-core or multicore (SMP) running modes. In the laster case, you have to + specify the number of slots used for running the analysis. + """ + + availablesModes = ["single-core", "threadpool", "multicore"] + + _default = ("single-core", 1) + + def configure(self, value): + """ + Configure the running mode. + + :param value: the running mode specification. It can be *'single-core'* or a 2-tuple whose first element \ + must be *'multicore'* and 2nd element the number of slots allocated for running the analysis. + :type value: *'single-core'* or 2-tuple + """ + + if isinstance(value, str): + mode = value + else: + mode = value[0].lower() + + if not mode in self.availablesModes: + self.error_status = f"{mode} is not a valid running mode." + return + + if mode == "single-core": + slots = 1 + + else: + slots = int(value[1]) + + if mode == "multicore": + maxSlots = multiprocessing.cpu_count() + if slots > maxSlots: + self.error_status = "invalid number of allocated slots." + return + + if slots <= 0: + self.error_status = "invalid number of allocated slots." + return + + self["mode"] = mode + + self["slots"] = slots + self.error_status = "OK" + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + return "Run in %s mode (%d slots)\n" % (self["mode"], self["slots"]) diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py index 8353c4778d..143b02632e 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py @@ -1,80 +1,84 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/SingleChoiceConfigurator.py -# @brief Implements module/class/test SingleChoiceConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class SingleChoiceConfigurator(IConfigurator): - """ - This Configurator allows to select a single item among multiple choices. - """ - - _default = [] - - def __init__(self, name, choices=None, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param choices: the list of values allowed for selection. - :type choices: list - """ - - IConfigurator.__init__(self, name, **kwargs) - - self._choices = choices if choices is not None else [] - - def configure(self, value): - """ - Configure the input item. - - :param value: the input selection list. - :type value: list - """ - - try: - self["index"] = self._choices.index(value) - except ValueError: - self.error_status = f"{value} item is not a valid choice" - return - else: - self["value"] = value - self.error_status = "OK" - - @property - def choices(self): - """ - Returns the list of allowed selection items. - - :return: the list of allowed selection items. - :rtype: list - """ - - return self._choices - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - return "Selected item: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class SingleChoiceConfigurator(IConfigurator): + """ + This Configurator allows to select a single item among multiple choices. + """ + + _default = [] + + def __init__(self, name, choices=None, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param choices: the list of values allowed for selection. + :type choices: list + """ + + IConfigurator.__init__(self, name, **kwargs) + + self._choices = choices if choices is not None else [] + + def configure(self, value): + """ + Configure the input item. + + :param value: the input selection list. + :type value: list + """ + + try: + self["index"] = self._choices.index(value) + except ValueError: + self.error_status = f"{value} item is not a valid choice" + return + else: + self["value"] = value + self.error_status = "OK" + + @property + def choices(self): + """ + Returns the list of allowed selection items. + + :return: the list of allowed selection items. + :rtype: list + """ + + return self._choices + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + return "Selected item: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py index 9294d055cc..bb3482129e 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py @@ -1,131 +1,135 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/OutputFilesConfigurator.py -# @brief Implements module/class/test OutputFilesConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -import os -from MDANSE import PLATFORM -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) -from MDANSE.Framework.Formats.IFormat import IFormat - - -class SingleOutputFileConfigurator(IConfigurator): - """ - This configurator allows to define the output directory, the basename, and the format(s) of the output file(s) - resulting from a trajectory conversion. - - Once configured, this configurator will provide a list of files built by joining the given output directory, - the basename and the extensions corresponding to the input file formats. - - For trajectories, MDANSE supports only the HDF format. To define a new output file format for a trajectory - conversion, you must inherit from the MDANSE.Framework.Formats.IFormat.IFormat interface. - """ - - _default = ("OUTPUT_FILENAME", "HDFFormat") - - def __init__(self, name, format=None, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param formats: the list of output file formats supported. - :type formats: list of str - """ - - IConfigurator.__init__(self, name, **kwargs) - - self._format = ( - format if format is not None else SingleOutputFileConfigurator._default[-1] - ) - - def configure(self, value): - """ - Configure a set of output files for an analysis. - - :param value: the output files specifications. Must be a 3-tuple whose 1st element \ - is the output directory, 2nd element the basename and 3rd element a list of file formats. - :type value: 3-tuple - """ - - root, format = value - - if not root: - self.error_status = "empty root name for the output file." - return - - dirname = os.path.dirname(root) - - try: - PLATFORM.create_directory(dirname) - except: - self.error_status = f"the directory {dirname} is not writable" - return - - if not format: - self.error_status = "no output format specified" - return - - if format != self._format: - self.error_status = ( - f"the output file format {format} is not a valid output format" - ) - return - - if format not in IFormat.subclasses(): - self.error_status = f"the output file format {format} is not registered as a valid file format." - return - - self["root"] = root - self["format"] = format - self["extension"] = IFormat.create(format).extension - temp_name = root - if not self["extension"] in temp_name[-5:]: # capture most extension lengths - temp_name += self["extension"] - self["file"] = temp_name - self.error_status = "OK" - - @property - def format(self): - """ - Returns the output file format supported. - - :return: the file format supported. - :rtype: str - """ - return self._format - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - info = "Output file: %s\n" % self["file"] - - return info - - @property - def default(self) -> tuple[str, str]: - """ - - Returns - ------- - tuple[str, str] - A tuple of the default filename and format. - """ - return self._default[0], self.format +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +import os +from MDANSE import PLATFORM +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) +from MDANSE.Framework.Formats.IFormat import IFormat + + +class SingleOutputFileConfigurator(IConfigurator): + """ + This configurator allows to define the output directory, the basename, and the format(s) of the output file(s) + resulting from a trajectory conversion. + + Once configured, this configurator will provide a list of files built by joining the given output directory, + the basename and the extensions corresponding to the input file formats. + + For trajectories, MDANSE supports only the HDF format. To define a new output file format for a trajectory + conversion, you must inherit from the MDANSE.Framework.Formats.IFormat.IFormat interface. + """ + + _default = ("OUTPUT_FILENAME", "HDFFormat") + + def __init__(self, name, format=None, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param formats: the list of output file formats supported. + :type formats: list of str + """ + + IConfigurator.__init__(self, name, **kwargs) + + self._format = ( + format if format is not None else SingleOutputFileConfigurator._default[-1] + ) + + def configure(self, value): + """ + Configure a set of output files for an analysis. + + :param value: the output files specifications. Must be a 3-tuple whose 1st element \ + is the output directory, 2nd element the basename and 3rd element a list of file formats. + :type value: 3-tuple + """ + + root, format = value + + if not root: + self.error_status = "empty root name for the output file." + return + + dirname = os.path.dirname(root) + + try: + PLATFORM.create_directory(dirname) + except: + self.error_status = f"the directory {dirname} is not writable" + return + + if not format: + self.error_status = "no output format specified" + return + + if format != self._format: + self.error_status = ( + f"the output file format {format} is not a valid output format" + ) + return + + if format not in IFormat.subclasses(): + self.error_status = f"the output file format {format} is not registered as a valid file format." + return + + self["root"] = root + self["format"] = format + self["extension"] = IFormat.create(format).extension + temp_name = root + if not self["extension"] in temp_name[-5:]: # capture most extension lengths + temp_name += self["extension"] + self["file"] = temp_name + self.error_status = "OK" + + @property + def format(self): + """ + Returns the output file format supported. + + :return: the file format supported. + :rtype: str + """ + return self._format + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + info = "Output file: %s\n" % self["file"] + + return info + + @property + def default(self) -> tuple[str, str]: + """ + + Returns + ------- + tuple[str, str] + A tuple of the default filename and format. + """ + return self._default[0], self.format diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py index 942ef7fd2f..78eb16aa52 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py @@ -1,106 +1,110 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/StringConfigurator.py -# @brief Implements module/class/test StringConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import ast - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class StringConfigurator(IConfigurator): - """ - This Configurator allows to input a string. - """ - - _default = "" - - def __init__(self, name, evalType=None, acceptNullString=True, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param evalType: the type to which the string will be evaluated or None if it is let as is. - :type evalType: python object or None - :param acceptNullString: if True a null (or blank) string can be input. - :type acceptNullString: bool - """ - - IConfigurator.__init__(self, name, **kwargs) - - self._evalType = evalType - - self._acceptNullString = acceptNullString - - def configure(self, value): - """ - Configure an input string. - - :param value: the input string - :type value: str - """ - - value = str(value) - - if not self._acceptNullString: - if not value.strip(): - self.error_status = "invalid null string" - return - - if self._evalType is not None: - value = ast.literal_eval(value) - if not isinstance(value, self._evalType): - self.error_status = ( - f"the string can not be eval to {self._evalType.__name__} type" - ) - return - - self["value"] = value - self.error_status = "OK" - - @property - def acceptNullString(self): - """ - Returns whether or not a null (or blank) string is accepted. - - :return: True if a null (or blank) string is accepted as input, False otherwise. - :rtype: bool - """ - - return self._acceptNullString - - @property - def evalType(self): - """ - Returns the type to which the string will be evaluated or None if it is let as is. - - :return: the type to which the string will be evaluated or None if it is let as is. - :rtype: python object or None - """ - - return self._evalType - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - return "Value: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import ast + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class StringConfigurator(IConfigurator): + """ + This Configurator allows to input a string. + """ + + _default = "" + + def __init__(self, name, evalType=None, acceptNullString=True, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param evalType: the type to which the string will be evaluated or None if it is let as is. + :type evalType: python object or None + :param acceptNullString: if True a null (or blank) string can be input. + :type acceptNullString: bool + """ + + IConfigurator.__init__(self, name, **kwargs) + + self._evalType = evalType + + self._acceptNullString = acceptNullString + + def configure(self, value): + """ + Configure an input string. + + :param value: the input string + :type value: str + """ + + value = str(value) + + if not self._acceptNullString: + if not value.strip(): + self.error_status = "invalid null string" + return + + if self._evalType is not None: + value = ast.literal_eval(value) + if not isinstance(value, self._evalType): + self.error_status = ( + f"the string can not be eval to {self._evalType.__name__} type" + ) + return + + self["value"] = value + self.error_status = "OK" + + @property + def acceptNullString(self): + """ + Returns whether or not a null (or blank) string is accepted. + + :return: True if a null (or blank) string is accepted as input, False otherwise. + :rtype: bool + """ + + return self._acceptNullString + + @property + def evalType(self): + """ + Returns the type to which the string will be evaluated or None if it is let as is. + + :return: the type to which the string will be evaluated or None if it is let as is. + :rtype: python object or None + """ + + return self._evalType + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + return "Value: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py index 05ccaba836..0b2e53506b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py @@ -1,59 +1,63 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/TrajectoryVariableConfigurator.py -# @brief Implements module/class/test TrajectoryVariableConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) - - -class TrajectoryVariableConfigurator(IConfigurator): - """ - This configurator allows to check that a given variable is actually present in a configuration. - - :note: this configurator depends on 'trajectory' configurator to be configured - """ - - _default = "velocities" - - def configure(self, value): - """ - Configure the configuration variable. - - :param configuration: the current configuration - :type configuration: a MDANSE.Framework.Configurable.Configurable object - :param value: the name of the trajectory variable as it should appear in the configuration - :type value: str - """ - - trajConfig = self._configurable[self._dependencies["trajectory"]] - - if not value in trajConfig["instance"].chemical_system.configuration: - self.error_status = f"{value} is not registered as a trajectory variable." - return - - self["value"] = value - self.error_status = "OK" - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - return "Selected variable: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) + + +class TrajectoryVariableConfigurator(IConfigurator): + """ + This configurator allows to check that a given variable is actually present in a configuration. + + :note: this configurator depends on 'trajectory' configurator to be configured + """ + + _default = "velocities" + + def configure(self, value): + """ + Configure the configuration variable. + + :param configuration: the current configuration + :type configuration: a MDANSE.Framework.Configurable.Configurable object + :param value: the name of the trajectory variable as it should appear in the configuration + :type value: str + """ + + trajConfig = self._configurable[self._dependencies["trajectory"]] + + if not value in trajConfig["instance"].chemical_system.configuration: + self.error_status = f"{value} is not registered as a trajectory variable." + return + + self["value"] = value + self.error_status = "OK" + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + return "Selected variable: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py index 954f427a90..f88785f454 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py @@ -1,144 +1,148 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/VectorConfigurator.py -# @brief Implements module/class/test VectorConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import numpy as np - - -from MDANSE.Framework.Configurators.IConfigurator import ( - IConfigurator, - ConfiguratorError, -) -from MDANSE.Mathematics.LinearAlgebra import Vector - - -class VectorConfigurator(IConfigurator): - """ - This configurator allows to input a 3D vector, by giving its 3 components - """ - - _default = [1.0, 0.0, 0.0] - - def __init__( - self, name, valueType=int, normalize=False, notNull=False, dimension=3, **kwargs - ): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - :param valueType: the numeric type for the vector. - :type valueType: int or float - :param normalize: if True the vector will be normalized. - :type normalize: bool - :param notNull: if True, the vector must be non-null. - :type notNull: bool - :param dimension: the dimension of the vector. - :type dimension: int - """ - - # The base class constructor. - IConfigurator.__init__(self, name, **kwargs) - - self._valueType = valueType - - self._normalize = normalize - - self._notNull = notNull - - self._dimension = dimension - - def configure(self, value): - """ - Configure a vector. - - :param value: the vector components. - :type value: sequence-like object - """ - - if not isinstance(value, (list, tuple)): - self.error_status = "Invalid input type" - return - - if len(value) != self._dimension: - self.error_status = "Invalid dimension" - return - - vector = Vector(np.array(value, dtype=self._valueType)) - - if self._normalize: - vector = vector.normal() - - if self._notNull: - if vector.length() == 0.0: - self.error_status = "The vector is null" - return - - self["vector"] = vector - self["value"] = vector - self.error_status = "OK" - - @property - def valueType(self): - """ - Returns the values type of the range. - - :return: the values type of the range. - :rtype: one of int or float - """ - - return self._valueType - - @property - def normalize(self): - """ - Returns whether or not the configured vector will be normalized. - - :return: True if the vector has to be normalized, False otherwise. - :rtype: bool - """ - - return self._normalize - - @property - def notNull(self): - """ - Returns whether or not a null vector is accepted. - - :return: True if a null vector is not accepted, False otherwise. - :rtype: bool - """ - - return self._notNull - - @property - def dimension(self): - """ - Returns the dimension of the vector. - - :return: the dimension of the vector. - :rtype: int - """ - - return self._dimension - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - return "Value: %r\n" % self["value"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import numpy as np + + +from MDANSE.Framework.Configurators.IConfigurator import ( + IConfigurator, + ConfiguratorError, +) +from MDANSE.Mathematics.LinearAlgebra import Vector + + +class VectorConfigurator(IConfigurator): + """ + This configurator allows to input a 3D vector, by giving its 3 components + """ + + _default = [1.0, 0.0, 0.0] + + def __init__( + self, name, valueType=int, normalize=False, notNull=False, dimension=3, **kwargs + ): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + :param valueType: the numeric type for the vector. + :type valueType: int or float + :param normalize: if True the vector will be normalized. + :type normalize: bool + :param notNull: if True, the vector must be non-null. + :type notNull: bool + :param dimension: the dimension of the vector. + :type dimension: int + """ + + # The base class constructor. + IConfigurator.__init__(self, name, **kwargs) + + self._valueType = valueType + + self._normalize = normalize + + self._notNull = notNull + + self._dimension = dimension + + def configure(self, value): + """ + Configure a vector. + + :param value: the vector components. + :type value: sequence-like object + """ + + if not isinstance(value, (list, tuple)): + self.error_status = "Invalid input type" + return + + if len(value) != self._dimension: + self.error_status = "Invalid dimension" + return + + vector = Vector(np.array(value, dtype=self._valueType)) + + if self._normalize: + vector = vector.normal() + + if self._notNull: + if vector.length() == 0.0: + self.error_status = "The vector is null" + return + + self["vector"] = vector + self["value"] = vector + self.error_status = "OK" + + @property + def valueType(self): + """ + Returns the values type of the range. + + :return: the values type of the range. + :rtype: one of int or float + """ + + return self._valueType + + @property + def normalize(self): + """ + Returns whether or not the configured vector will be normalized. + + :return: True if the vector has to be normalized, False otherwise. + :rtype: bool + """ + + return self._normalize + + @property + def notNull(self): + """ + Returns whether or not a null vector is accepted. + + :return: True if a null vector is not accepted, False otherwise. + :rtype: bool + """ + + return self._notNull + + @property + def dimension(self): + """ + Returns the dimension of the vector. + + :return: the dimension of the vector. + :rtype: int + """ + + return self._dimension + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + return "Value: %r\n" % self["value"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py index c43b8e56a9..dba06b2183 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py @@ -1,95 +1,99 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Configurators/WeightsConfigurator.py -# @brief Implements module/class/test WeightsConfigurator -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from MDANSE.Chemistry import ATOMS_DATABASE -from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError -from MDANSE.Framework.Configurators.SingleChoiceConfigurator import ( - SingleChoiceConfigurator, -) - - -class WeightsConfigurator(SingleChoiceConfigurator): - """ - This configurator allows to select how the properties that depends on atom type will be weighted when computing - the total contribution of all atoms. - - Any numeric property defined in MDANSE.Data.ElementsDatabase.ElementsDatabase can be used as a weigh. - """ - - _default = "equal" - - def __init__(self, name, **kwargs): - """ - Initializes the configurator. - - :param name: the name of the configurator as it will appear in the configuration. - :type name: str - """ - - SingleChoiceConfigurator.__init__( - self, name, choices=ATOMS_DATABASE.numeric_properties, **kwargs - ) - - def configure(self, value): - """ - Configure the weight. - - :param value: the name of the weight to use. - :type value: one of the numeric properties of MDANSE.Data.ElementsDatabase.ElementsDatabase - """ - - if not isinstance(value, str): - self.error_status = "Invalid type for weight. Must be a string." - return - - value = value.lower() - - if not value in ATOMS_DATABASE.numeric_properties: - self.error_status = ( - f"weight {value} is not registered as a valid numeric property." - ) - return - - self["property"] = value - self.error_status = "OK" - - def get_weights(self): - ascfg = self._configurable[self._dependencies["atom_selection"]] - - weights = {} - for i in range(ascfg["selection_length"]): - name = ascfg["names"][i] - for el in ascfg["elements"][i]: - p = ATOMS_DATABASE.get_atom_property(el, self["property"]) - if name in weights: - weights[name] += p - else: - weights[name] = p - - for k, v in list(ascfg.get_natoms().items()): - weights[k] /= v - - return weights - - def get_information(self): - """ - Returns string information about this configurator. - - :return: the information about this configurator. - :rtype: str - """ - - return "selected weight: %s\n" % self["property"] +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from MDANSE.Chemistry import ATOMS_DATABASE +from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError +from MDANSE.Framework.Configurators.SingleChoiceConfigurator import ( + SingleChoiceConfigurator, +) + + +class WeightsConfigurator(SingleChoiceConfigurator): + """ + This configurator allows to select how the properties that depends on atom type will be weighted when computing + the total contribution of all atoms. + + Any numeric property defined in MDANSE.Data.ElementsDatabase.ElementsDatabase can be used as a weigh. + """ + + _default = "equal" + + def __init__(self, name, **kwargs): + """ + Initializes the configurator. + + :param name: the name of the configurator as it will appear in the configuration. + :type name: str + """ + + SingleChoiceConfigurator.__init__( + self, name, choices=ATOMS_DATABASE.numeric_properties, **kwargs + ) + + def configure(self, value): + """ + Configure the weight. + + :param value: the name of the weight to use. + :type value: one of the numeric properties of MDANSE.Data.ElementsDatabase.ElementsDatabase + """ + + if not isinstance(value, str): + self.error_status = "Invalid type for weight. Must be a string." + return + + value = value.lower() + + if not value in ATOMS_DATABASE.numeric_properties: + self.error_status = ( + f"weight {value} is not registered as a valid numeric property." + ) + return + + self["property"] = value + self.error_status = "OK" + + def get_weights(self): + ascfg = self._configurable[self._dependencies["atom_selection"]] + + weights = {} + for i in range(ascfg["selection_length"]): + name = ascfg["names"][i] + for el in ascfg["elements"][i]: + p = ATOMS_DATABASE.get_atom_property(el, self["property"]) + if name in weights: + weights[name] += p + else: + weights[name] = p + + for k, v in list(ascfg.get_natoms().items()): + weights[k] /= v + + return weights + + def get_information(self): + """ + Returns string information about this configurator. + + :return: the information about this configurator. + :rtype: str + """ + + return "selected weight: %s\n" % self["property"] diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py index ebc0d061bf..875ace2a05 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Configurators/XDATCARFileConfigurator.py -# @brief Implements module/class/test VASP +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py index 933e58321c..f6ba08d8dd 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Configurators/XTDFileConfigurator.py -# @brief Implements module/class/test XTDFileConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import xml.etree.ElementTree as ElementTree diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py index c16bf1c203..55a52d1459 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Configurators/XYZFileConfigurator.py -# @brief Implements module/class/test XYZFileConfigurator +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py b/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py index 0543297acb..6e3f0c890e 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Configurators/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/ASE.py b/MDANSE/Src/MDANSE/Framework/Converters/ASE.py index 7ff784261d..a14777e8e4 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/ASE.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/ASE.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/ASEConverter.py -# @brief Implements a general-purpose loader based on ASE +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py b/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py index 7aa29d3df5..f62bc4176a 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py @@ -1,170 +1,174 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/Castep.py -# @brief Implements module/class/test Castep -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -import collections - -from MDANSE.Chemistry.ChemicalEntity import Atom, ChemicalSystem -from MDANSE.Core.Error import Error -from MDANSE.Framework.Converters.Converter import Converter -from MDANSE.Framework.Units import measure -from MDANSE.MolecularDynamics.Configuration import PeriodicRealConfiguration -from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter -from MDANSE.Framework.AtomMapping import get_element_from_mapping - - -HBAR = measure(1.05457182e-34, "kg m2 / s").toval("uma nm2 / ps") -HARTREE = measure(27.2113845, "eV").toval("uma nm2 / ps2") -BOHR = measure(5.29177210903e-11, "m").toval("nm") - - -class CASTEPError(Error): - pass - - -class CASTEP(Converter): - """ - Converts a Castep Trajectory into a HDF trajectory file. - """ - - label = "CASTEP" - - settings = collections.OrderedDict() - settings["castep_file"] = ( - "MDFileConfigurator", - { - "wildcard": "MD files (*.md)|*.md|All files|*", - "default": "INPUT_FILENAME.md", - "label": "Input MD file", - }, - ) - settings["atom_aliases"] = ( - "AtomMappingConfigurator", - { - "default": "{}", - "label": "Atom mapping", - "dependencies": {"input_file": "castep_file"}, - }, - ) - settings["fold"] = ( - "BooleanConfigurator", - {"default": False, "label": "Fold coordinates into box"}, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - { - "formats": ["MDTFormat"], - "root": "castep_file", - "label": "MDANSE trajectory (filename, format)", - }, - ) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - self._atomicAliases = self.configuration["atom_aliases"]["value"] - - # Create a representation of md file - self._castepFile = self.configuration["castep_file"] - - # Save the number of steps - self.numberOfSteps = self._castepFile["n_frames"] - - # Create a bound universe - self._chemical_system = ChemicalSystem() - - # Populate the universe with atoms based on how many of each atom is in the read trajectory - for symbol, number in self._castepFile["atoms"]: - for i in range(number): - element = get_element_from_mapping(self._atomicAliases, symbol) - self._chemical_system.add_chemical_entity( - Atom(symbol=element, name="%s_%d" % (symbol, i)) - ) - - # A trajectory is opened for writing. - self._trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - self._chemical_system, - self.numberOfSteps, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - def run_step(self, index): - """Runs a single step of the job. - - @param index: the index of the step. - @type index: int. - - :return: The index of the step and None - :rtype: (int, None)-tuple - - @note: the argument index is the index of the loop not the index of the frame. - """ - - # Retrieve the number of atoms - nAtoms = self._castepFile["n_atoms"] - - # Read the informatino in the frame - time_step, unit_cell, config = self._castepFile.read_step(index) - - coords = config[0:nAtoms, :] - variables = {} - variables["velocities"] = config[nAtoms : 2 * nAtoms, :] - variables["gradients"] = config[2 * nAtoms : 3 * nAtoms, :] - - conf = PeriodicRealConfiguration( - self._trajectory.chemical_system, coords, unit_cell, **variables - ) - - if self.configuration["fold"]["value"]: - conf.fold_coordinates() - - self._trajectory.chemical_system.configuration = conf - - self._trajectory.dump_configuration( - time_step, - units={ - "time": "ps", - "coordinates": "nm", - "unit_cell": "nm", - "velocities": "nm/ps", - "gradients": "uma nm/ps2", - }, - ) - - return index, None - - def combine(self, index, x): - """ - @param index: the index of the step. - @type index: int. - - @param x: - @type x: any. - """ - - pass - - def finalize(self): - """ - Finalize the job. - """ - - self._castepFile.close() # Close the .md file. - - # Close the output trajectory. - self._trajectory.close() - - super(CASTEP, self).finalize() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +import collections + +from MDANSE.Chemistry.ChemicalEntity import Atom, ChemicalSystem +from MDANSE.Core.Error import Error +from MDANSE.Framework.Converters.Converter import Converter +from MDANSE.Framework.Units import measure +from MDANSE.MolecularDynamics.Configuration import PeriodicRealConfiguration +from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter +from MDANSE.Framework.AtomMapping import get_element_from_mapping + + +HBAR = measure(1.05457182e-34, "kg m2 / s").toval("uma nm2 / ps") +HARTREE = measure(27.2113845, "eV").toval("uma nm2 / ps2") +BOHR = measure(5.29177210903e-11, "m").toval("nm") + + +class CASTEPError(Error): + pass + + +class CASTEP(Converter): + """ + Converts a Castep Trajectory into a HDF trajectory file. + """ + + label = "CASTEP" + + settings = collections.OrderedDict() + settings["castep_file"] = ( + "MDFileConfigurator", + { + "wildcard": "MD files (*.md)|*.md|All files|*", + "default": "INPUT_FILENAME.md", + "label": "Input MD file", + }, + ) + settings["atom_aliases"] = ( + "AtomMappingConfigurator", + { + "default": "{}", + "label": "Atom mapping", + "dependencies": {"input_file": "castep_file"}, + }, + ) + settings["fold"] = ( + "BooleanConfigurator", + {"default": False, "label": "Fold coordinates into box"}, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + { + "formats": ["MDTFormat"], + "root": "castep_file", + "label": "MDANSE trajectory (filename, format)", + }, + ) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + self._atomicAliases = self.configuration["atom_aliases"]["value"] + + # Create a representation of md file + self._castepFile = self.configuration["castep_file"] + + # Save the number of steps + self.numberOfSteps = self._castepFile["n_frames"] + + # Create a bound universe + self._chemical_system = ChemicalSystem() + + # Populate the universe with atoms based on how many of each atom is in the read trajectory + for symbol, number in self._castepFile["atoms"]: + for i in range(number): + element = get_element_from_mapping(self._atomicAliases, symbol) + self._chemical_system.add_chemical_entity( + Atom(symbol=element, name="%s_%d" % (symbol, i)) + ) + + # A trajectory is opened for writing. + self._trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + self._chemical_system, + self.numberOfSteps, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + def run_step(self, index): + """Runs a single step of the job. + + @param index: the index of the step. + @type index: int. + + :return: The index of the step and None + :rtype: (int, None)-tuple + + @note: the argument index is the index of the loop not the index of the frame. + """ + + # Retrieve the number of atoms + nAtoms = self._castepFile["n_atoms"] + + # Read the informatino in the frame + time_step, unit_cell, config = self._castepFile.read_step(index) + + coords = config[0:nAtoms, :] + variables = {} + variables["velocities"] = config[nAtoms : 2 * nAtoms, :] + variables["gradients"] = config[2 * nAtoms : 3 * nAtoms, :] + + conf = PeriodicRealConfiguration( + self._trajectory.chemical_system, coords, unit_cell, **variables + ) + + if self.configuration["fold"]["value"]: + conf.fold_coordinates() + + self._trajectory.chemical_system.configuration = conf + + self._trajectory.dump_configuration( + time_step, + units={ + "time": "ps", + "coordinates": "nm", + "unit_cell": "nm", + "velocities": "nm/ps", + "gradients": "uma nm/ps2", + }, + ) + + return index, None + + def combine(self, index, x): + """ + @param index: the index of the step. + @type index: int. + + @param x: + @type x: any. + """ + + pass + + def finalize(self): + """ + Finalize the job. + """ + + self._castepFile.close() # Close the .md file. + + # Close the output trajectory. + self._trajectory.close() + + super(CASTEP, self).finalize() diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py b/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py index 4382d8ae9d..686f4790a0 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/CHARMM.py -# @brief Implements module/class/test CHARMM +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py b/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py index cc3eced7dc..f27248865c 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/VASP.py -# @brief Implements module/class/test VASP +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Converter.py b/MDANSE/Src/MDANSE/Framework/Converters/Converter.py index 472b814e59..a471b93f17 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Converter.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Converter.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/Converter.py -# @brief Implements module/class/test Converter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from abc import ABCMeta, abstractmethod, abstractclassmethod diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DCD.py b/MDANSE/Src/MDANSE/Framework/Converters/DCD.py index c8afe8dd06..35b07ca90f 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DCD.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DCD.py @@ -1,392 +1,396 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/DCDConverter.py -# @brief Implements module/class/test DCDConverter -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import os -import struct - -import numpy as np - -from MDANSE.Core.Error import Error -from MDANSE.Framework.Converters.Converter import Converter -from MDANSE.Framework.Units import measure -from MDANSE.IO.PDBReader import PDBReader -from MDANSE.Mathematics.Geometry import get_basis_vectors_from_cell_parameters -from MDANSE.MolecularDynamics.Configuration import PeriodicRealConfiguration -from MDANSE.MolecularDynamics.Trajectory import ( - resolve_undefined_molecules_name, - TrajectoryWriter, -) -from MDANSE.MolecularDynamics.UnitCell import UnitCell - -PI_2 = 0.5 * np.pi -RECSCALE32BIT = 1 -RECSCALE64BIT = 2 - - -class DCDFileError(Error): - pass - - -class ByteOrderError(Error): - pass - - -class InputOutputError(Error): - pass - - -class EndOfFile(Error): - pass - - -class FortranBinaryFileError(Error): - pass - - -def get_byte_order(filename): - # Identity the byte order of the file by trial-and-error - byteOrder = None - - # The DCD file is opened for reading in binary mode. - data = open(filename, "rb").read(4) - - # Check for low and big endianness byte orders. - for order in ["<", ">"]: - reclen = struct.unpack(order + "i", data)[0] - if reclen == 84: - byteOrder = order - break - - if byteOrder is None: - raise ByteOrderError( - "Invalid byte order. %s is not a valid DCD file" % filename - ) - - return byteOrder - - -class FortranBinaryFile(object): - """Sets up a Fortran binary file reader. - - @note: written by Konrad Hinsen. - """ - - def __init__(self, filename): - """The constructor. - - @param filename: the input file. - @type filename: string. - - @param byte_order: the byte order to read the binary file. - @type byte_order: string being one '@', '=', '<', '>' or '!'. - """ - self.file = open(filename, "rb") - self.byteOrder = get_byte_order(filename) - - def __iter__(self): - return self - - def next_record(self): - data = self.file.read(struct.calcsize("i")) - if not data: - raise StopIteration - reclen = struct.unpack(self.byteOrder + "i", data)[0] - data = self.file.read(reclen) - reclen2 = struct.unpack( - self.byteOrder + "i", self.file.read(struct.calcsize("i")) - )[0] - if reclen != reclen2: - FortranBinaryFileError("Invalid block") - - return data - - def skip_record(self): - data = self.file.read(struct.calcsize("i")) - reclen = struct.unpack(self.byteOrder + "i", data)[0] - self.file.seek(reclen, 1) - reclen2 = struct.unpack(self.byteOrder + "i", self.file.read(4))[0] - assert reclen == reclen2 - - def get_record(self, fmt, repeat=False): - """Reads a record of the binary file. - - @param format: the format corresponding to the binray structure to read. - @type format: string. - - @param repeat: if True, will repeat the reading. - @type repeat: bool. - """ - - try: - data = self.next_record() - except StopIteration: - raise EndOfFile() - if repeat: - unit = struct.calcsize(self.byteOrder + fmt) - assert len(data) % unit == 0 - fmt = (len(data) / unit) * fmt - try: - return struct.unpack(self.byteOrder + fmt, data) - except: - raise - - -class DCDFile(FortranBinaryFile, dict): - def __init__(self, filename): - FortranBinaryFile.__init__(self, filename) - - self["filename"] = filename - - self.read_header() - - def read_header(self): - # Read a block - data = self.next_record() - - if data[:4] != b"CORD": - raise DCDFileError("Unrecognized DCD format") - - temp = struct.unpack(self.byteOrder + "20i", data[4:]) - - self["charmm"] = temp[-1] - - if self["charmm"]: - temp = struct.unpack(self.byteOrder + "9if10i", data[4:]) - else: - temp = struct.unpack(self.byteOrder + "9id9i", data[4:]) - - # Store the number of sets of coordinates - self["nset"] = self["n_frames"] = temp[0] - - # Store the starting time step - self["istart"] = temp[1] - - # Store the number of timesteps between dcd saves - self["nsavc"] = temp[2] - - # Stores the number of fixed atoms - self["namnf"] = temp[8] - - # Stop if there are fixed atoms. - if self["namnf"] > 0: - raise DCDFileError("Can not handle fixed atoms yet.") - - self["delta"] = temp[9] - - # The time step is in AKMA time - self["time_step"] = ( - self["nsavc"] * self["delta"] * measure(1.0, "akma_time").toval("ps") - ) - - self["has_pbc_data"] = temp[10] - - self["has_4d"] = temp[11] - - # Read a block - data = self.next_record() - - nLines = struct.unpack(self.byteOrder.encode() + b"I", data[0:4])[0] - - self["title"] = [] - for i in range(nLines): - temp = struct.unpack( - self.byteOrder + "80c", data[4 + 80 * i : 4 + 80 * (i + 1)] - ) - self["title"].append(b"".join(temp).strip()) - - self["title"] = b"\n".join(self["title"]) - - # Read a block - data = self.next_record() - - # Read the number of atoms. - self["natoms"] = struct.unpack(self.byteOrder.encode() + b"I", data)[0] - - def read_step(self): - """ - Reads a frame of the DCD file. - """ - - if self["has_pbc_data"]: - unitCell = np.array(self.get_record("6d"), dtype=np.float64) - unitCell = unitCell[[0, 2, 5, 1, 3, 4]] - # The unit cell is converted from ang to nm - unitCell[0:3] *= measure(1.0, "ang").toval("nm") - # This file was generated by CHARMM, or by NAMD > 2.5, with the angle - # cosines of the periodic cell angles written to the DCD file. - # This formulation improves rounding behavior for orthogonal cells - # so that the angles end up at precisely 90 degrees, unlike acos(). - # See https://github.com/MDAnalysis/mdanalysis/wiki/FileFormats for info - if np.all(abs(unitCell[3:]) <= 1): - unitCell[3:] = PI_2 - np.arcsin(unitCell[3:]) - else: - # assume the angles are stored in degrees (NAMD <= 2.5) - unitCell[3:] = np.deg2rad(unitCell[3:]) - - else: - unitCell = None - - fmt = "%df" % self["natoms"] - config = np.empty((self["natoms"], 3), dtype=np.float64) - config[:, 0] = np.array(self.get_record(fmt), dtype=np.float64) - config[:, 1] = np.array(self.get_record(fmt), dtype=np.float64) - config[:, 2] = np.array(self.get_record(fmt), dtype=np.float64) - config *= measure(1.0, "ang").toval("nm") - - if self["has_4d"]: - self.skip_record() - - return unitCell, config - - def skip_step(self): - """Skips a frame of the DCD file.""" - nrecords = 3 - if self["has_pbc_data"]: - nrecords += 1 - if self["has_4d"]: - nrecords += 1 - for _ in range(nrecords): - self["binary"].skip_record() - - def __iter__(self): - return self - - def next_step(self): - try: - return self.read_step() - except EndOfFile: - raise StopIteration - - -class DCD(Converter): - """ - Converts a DCD trajectory to a HDF trajectory. - """ - - settings = collections.OrderedDict() - settings["pdb_file"] = ( - "InputFileConfigurator", - { - "wildcard": "PDB files (*.pdb)|*.pdb|All files|*", - "default": "INPUT_FILENAME.pdb", - "label": "Input PDB file", - }, - ) - settings["dcd_file"] = ( - "InputFileConfigurator", - { - "wildcard": "DCD files (*.dcd)|*.dcd|All files|*", - "default": "INPUT_FILENAME.dcd", - "label": "Input DCD file", - }, - ) - settings["time_step"] = ( - "FloatConfigurator", - {"default": 1.0, "label": "Time step (ps)"}, - ) - settings["fold"] = ( - "BooleanConfigurator", - {"default": False, "label": "Fold coordinates into box"}, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - { - "formats": ["MDTFormat"], - "root": "pdb_file", - "label": "MDANSE trajectory (filename, format)", - }, - ) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.configuration["dcd_file"]["instance"] = DCDFile( - self.configuration["dcd_file"]["filename"] - ) - - # The number of steps of the analysis. - self.numberOfSteps = self.configuration["dcd_file"]["instance"]["n_frames"] - - # Create all chemical entities from the PDB file. - pdb_reader = PDBReader(self.configuration["pdb_file"]["filename"]) - self._chemical_system = pdb_reader.build_chemical_system() - - resolve_undefined_molecules_name(self._chemical_system) - - # A trajectory is opened for writing. - self._trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - self._chemical_system, - self.numberOfSteps, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - """ - - # The x, y and z values of the current frame. - unit_cell, config = self.configuration["dcd_file"]["instance"].read_step() - unit_cell = get_basis_vectors_from_cell_parameters(unit_cell) - unit_cell = UnitCell(unit_cell) - - conf = PeriodicRealConfiguration( - self._trajectory._chemical_system, config, unit_cell - ) - - if self.configuration["fold"]["value"]: - conf.fold_coordinates() - - self._trajectory._chemical_system.configuration = conf - - # The current time. - time = (index + 1) * self.configuration["time_step"]["value"] - - # Store a snapshot of the current configuration in the output trajectory. - self._trajectory.dump_configuration( - time, units={"time": "ps", "unit_cell": "nm", "coordinates": "nm"} - ) - - return index, None - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - pass - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - # Close the output trajectory. - self._trajectory.close() - - super(DCD, self).finalize() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import os +import struct + +import numpy as np + +from MDANSE.Core.Error import Error +from MDANSE.Framework.Converters.Converter import Converter +from MDANSE.Framework.Units import measure +from MDANSE.IO.PDBReader import PDBReader +from MDANSE.Mathematics.Geometry import get_basis_vectors_from_cell_parameters +from MDANSE.MolecularDynamics.Configuration import PeriodicRealConfiguration +from MDANSE.MolecularDynamics.Trajectory import ( + resolve_undefined_molecules_name, + TrajectoryWriter, +) +from MDANSE.MolecularDynamics.UnitCell import UnitCell + +PI_2 = 0.5 * np.pi +RECSCALE32BIT = 1 +RECSCALE64BIT = 2 + + +class DCDFileError(Error): + pass + + +class ByteOrderError(Error): + pass + + +class InputOutputError(Error): + pass + + +class EndOfFile(Error): + pass + + +class FortranBinaryFileError(Error): + pass + + +def get_byte_order(filename): + # Identity the byte order of the file by trial-and-error + byteOrder = None + + # The DCD file is opened for reading in binary mode. + data = open(filename, "rb").read(4) + + # Check for low and big endianness byte orders. + for order in ["<", ">"]: + reclen = struct.unpack(order + "i", data)[0] + if reclen == 84: + byteOrder = order + break + + if byteOrder is None: + raise ByteOrderError( + "Invalid byte order. %s is not a valid DCD file" % filename + ) + + return byteOrder + + +class FortranBinaryFile(object): + """Sets up a Fortran binary file reader. + + @note: written by Konrad Hinsen. + """ + + def __init__(self, filename): + """The constructor. + + @param filename: the input file. + @type filename: string. + + @param byte_order: the byte order to read the binary file. + @type byte_order: string being one '@', '=', '<', '>' or '!'. + """ + self.file = open(filename, "rb") + self.byteOrder = get_byte_order(filename) + + def __iter__(self): + return self + + def next_record(self): + data = self.file.read(struct.calcsize("i")) + if not data: + raise StopIteration + reclen = struct.unpack(self.byteOrder + "i", data)[0] + data = self.file.read(reclen) + reclen2 = struct.unpack( + self.byteOrder + "i", self.file.read(struct.calcsize("i")) + )[0] + if reclen != reclen2: + FortranBinaryFileError("Invalid block") + + return data + + def skip_record(self): + data = self.file.read(struct.calcsize("i")) + reclen = struct.unpack(self.byteOrder + "i", data)[0] + self.file.seek(reclen, 1) + reclen2 = struct.unpack(self.byteOrder + "i", self.file.read(4))[0] + assert reclen == reclen2 + + def get_record(self, fmt, repeat=False): + """Reads a record of the binary file. + + @param format: the format corresponding to the binray structure to read. + @type format: string. + + @param repeat: if True, will repeat the reading. + @type repeat: bool. + """ + + try: + data = self.next_record() + except StopIteration: + raise EndOfFile() + if repeat: + unit = struct.calcsize(self.byteOrder + fmt) + assert len(data) % unit == 0 + fmt = (len(data) / unit) * fmt + try: + return struct.unpack(self.byteOrder + fmt, data) + except: + raise + + +class DCDFile(FortranBinaryFile, dict): + def __init__(self, filename): + FortranBinaryFile.__init__(self, filename) + + self["filename"] = filename + + self.read_header() + + def read_header(self): + # Read a block + data = self.next_record() + + if data[:4] != b"CORD": + raise DCDFileError("Unrecognized DCD format") + + temp = struct.unpack(self.byteOrder + "20i", data[4:]) + + self["charmm"] = temp[-1] + + if self["charmm"]: + temp = struct.unpack(self.byteOrder + "9if10i", data[4:]) + else: + temp = struct.unpack(self.byteOrder + "9id9i", data[4:]) + + # Store the number of sets of coordinates + self["nset"] = self["n_frames"] = temp[0] + + # Store the starting time step + self["istart"] = temp[1] + + # Store the number of timesteps between dcd saves + self["nsavc"] = temp[2] + + # Stores the number of fixed atoms + self["namnf"] = temp[8] + + # Stop if there are fixed atoms. + if self["namnf"] > 0: + raise DCDFileError("Can not handle fixed atoms yet.") + + self["delta"] = temp[9] + + # The time step is in AKMA time + self["time_step"] = ( + self["nsavc"] * self["delta"] * measure(1.0, "akma_time").toval("ps") + ) + + self["has_pbc_data"] = temp[10] + + self["has_4d"] = temp[11] + + # Read a block + data = self.next_record() + + nLines = struct.unpack(self.byteOrder.encode() + b"I", data[0:4])[0] + + self["title"] = [] + for i in range(nLines): + temp = struct.unpack( + self.byteOrder + "80c", data[4 + 80 * i : 4 + 80 * (i + 1)] + ) + self["title"].append(b"".join(temp).strip()) + + self["title"] = b"\n".join(self["title"]) + + # Read a block + data = self.next_record() + + # Read the number of atoms. + self["natoms"] = struct.unpack(self.byteOrder.encode() + b"I", data)[0] + + def read_step(self): + """ + Reads a frame of the DCD file. + """ + + if self["has_pbc_data"]: + unitCell = np.array(self.get_record("6d"), dtype=np.float64) + unitCell = unitCell[[0, 2, 5, 1, 3, 4]] + # The unit cell is converted from ang to nm + unitCell[0:3] *= measure(1.0, "ang").toval("nm") + # This file was generated by CHARMM, or by NAMD > 2.5, with the angle + # cosines of the periodic cell angles written to the DCD file. + # This formulation improves rounding behavior for orthogonal cells + # so that the angles end up at precisely 90 degrees, unlike acos(). + # See https://github.com/MDAnalysis/mdanalysis/wiki/FileFormats for info + if np.all(abs(unitCell[3:]) <= 1): + unitCell[3:] = PI_2 - np.arcsin(unitCell[3:]) + else: + # assume the angles are stored in degrees (NAMD <= 2.5) + unitCell[3:] = np.deg2rad(unitCell[3:]) + + else: + unitCell = None + + fmt = "%df" % self["natoms"] + config = np.empty((self["natoms"], 3), dtype=np.float64) + config[:, 0] = np.array(self.get_record(fmt), dtype=np.float64) + config[:, 1] = np.array(self.get_record(fmt), dtype=np.float64) + config[:, 2] = np.array(self.get_record(fmt), dtype=np.float64) + config *= measure(1.0, "ang").toval("nm") + + if self["has_4d"]: + self.skip_record() + + return unitCell, config + + def skip_step(self): + """Skips a frame of the DCD file.""" + nrecords = 3 + if self["has_pbc_data"]: + nrecords += 1 + if self["has_4d"]: + nrecords += 1 + for _ in range(nrecords): + self["binary"].skip_record() + + def __iter__(self): + return self + + def next_step(self): + try: + return self.read_step() + except EndOfFile: + raise StopIteration + + +class DCD(Converter): + """ + Converts a DCD trajectory to a HDF trajectory. + """ + + settings = collections.OrderedDict() + settings["pdb_file"] = ( + "InputFileConfigurator", + { + "wildcard": "PDB files (*.pdb)|*.pdb|All files|*", + "default": "INPUT_FILENAME.pdb", + "label": "Input PDB file", + }, + ) + settings["dcd_file"] = ( + "InputFileConfigurator", + { + "wildcard": "DCD files (*.dcd)|*.dcd|All files|*", + "default": "INPUT_FILENAME.dcd", + "label": "Input DCD file", + }, + ) + settings["time_step"] = ( + "FloatConfigurator", + {"default": 1.0, "label": "Time step (ps)"}, + ) + settings["fold"] = ( + "BooleanConfigurator", + {"default": False, "label": "Fold coordinates into box"}, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + { + "formats": ["MDTFormat"], + "root": "pdb_file", + "label": "MDANSE trajectory (filename, format)", + }, + ) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.configuration["dcd_file"]["instance"] = DCDFile( + self.configuration["dcd_file"]["filename"] + ) + + # The number of steps of the analysis. + self.numberOfSteps = self.configuration["dcd_file"]["instance"]["n_frames"] + + # Create all chemical entities from the PDB file. + pdb_reader = PDBReader(self.configuration["pdb_file"]["filename"]) + self._chemical_system = pdb_reader.build_chemical_system() + + resolve_undefined_molecules_name(self._chemical_system) + + # A trajectory is opened for writing. + self._trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + self._chemical_system, + self.numberOfSteps, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + """ + + # The x, y and z values of the current frame. + unit_cell, config = self.configuration["dcd_file"]["instance"].read_step() + unit_cell = get_basis_vectors_from_cell_parameters(unit_cell) + unit_cell = UnitCell(unit_cell) + + conf = PeriodicRealConfiguration( + self._trajectory._chemical_system, config, unit_cell + ) + + if self.configuration["fold"]["value"]: + conf.fold_coordinates() + + self._trajectory._chemical_system.configuration = conf + + # The current time. + time = (index + 1) * self.configuration["time_step"]["value"] + + # Store a snapshot of the current configuration in the output trajectory. + self._trajectory.dump_configuration( + time, units={"time": "ps", "unit_cell": "nm", "coordinates": "nm"} + ) + + return index, None + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + pass + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + # Close the output trajectory. + self._trajectory.close() + + super(DCD, self).finalize() diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py b/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py index 3a6f187a9c..763c186758 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Jobs/DFTB.py -# @brief Implements module/class/test DFTB +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py b/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py index ff8e9b17f3..0b16f6eb43 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py @@ -1,372 +1,376 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file MDANSE/Framework/Jobs/DL_POLY.py -# @brief Implements module/class/test DL_POLY -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -import collections -import numpy as np - -from MDANSE.Chemistry.ChemicalEntity import ChemicalSystem -from MDANSE.Core.Error import Error -from MDANSE.Framework.Converters.Converter import Converter -from MDANSE.Framework.Units import measure -from MDANSE.MolecularDynamics.Configuration import ( - PeriodicRealConfiguration, - RealConfiguration, -) -from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter -from MDANSE.MolecularDynamics.UnitCell import UnitCell - - -_HISTORY_FORMAT = {} -_HISTORY_FORMAT["2"] = { - "rec1": 81, - "rec2": 31, - "reci": 61, - "recii": 37, - "reciii": 37, - "reciv": 37, - "reca": 43, - "recb": 37, - "recc": 37, - "recd": 37, -} -_HISTORY_FORMAT["3"] = { - "rec1": 73, - "rec2": 73, - "reci": 73, - "recii": 73, - "reciii": 73, - "reciv": 73, - "reca": 73, - "recb": 73, - "recc": 73, - "recd": 73, -} -_HISTORY_FORMAT["4"] = { - "rec1": 73, - "rec2": 73, - "reci": 73, - "recii": 73, - "reciii": 73, - "reciv": 73, - "reca": 73, - "recb": 73, - "recc": 73, - "recd": 73, -} - - -class HistoryFileError(Error): - pass - - -class DL_POLYConverterError(Error): - pass - - -class HistoryFile(dict): - - def __init__(self, filename): - super().__init__() - self["instance"] = open(filename, "rb") - - version = self.determine_version() - self["version"] = version - - lenTestLine = len(self["instance"].readline()) - - self["instance"].seek(0, 0) - - offset = lenTestLine - _HISTORY_FORMAT[self["version"]]["rec1"] - - self._headerSize = ( - _HISTORY_FORMAT[self["version"]]["rec1"] - + _HISTORY_FORMAT[self["version"]]["rec2"] - + 2 * offset - ) - - self["instance"].read(_HISTORY_FORMAT[self["version"]]["rec1"] + offset) - - data = self["instance"].read(_HISTORY_FORMAT[self["version"]]["rec2"] + offset) - - self["keytrj"], self["imcon"], self["natms"] = [ - int(v) for v in data.split()[0:3] - ] - - if self["keytrj"] not in list(range(3)): - raise HistoryFileError("Invalid value for trajectory output key.") - - if self["imcon"] not in list(range(4)): - raise HistoryFileError( - "Invalid value for periodic boundary conditions key." - ) - - if self["imcon"] == 0: - self._configHeaderSize = _HISTORY_FORMAT[self["version"]]["reci"] - else: - self._configHeaderSize = ( - _HISTORY_FORMAT[self["version"]]["reci"] - + 3 * _HISTORY_FORMAT[self["version"]]["recii"] - + 4 * offset - ) - - self._configSize = ( - _HISTORY_FORMAT[self["version"]]["reca"] - + offset - + (self["keytrj"] + 1) * (_HISTORY_FORMAT[self["version"]]["recb"] + offset) - ) * self["natms"] - - self._frameSize = self._configHeaderSize + self._configSize - - self["instance"].seek(0, 2) - - self["n_frames"] = ( - self["instance"].tell() - self._headerSize - ) / self._frameSize - - self["instance"].seek(self._headerSize) - - data = self["instance"].read(self._configHeaderSize).splitlines() - - line = data[0].split() - - self._firstStep = int(line[1]) - - self._timeStep = float(line[5]) - - self._maskStep = 3 + 3 * (self["keytrj"] + 1) + 1 - - if (self["version"] == "3") or (self["version"] == "4"): - self._maskStep += 1 - - self["instance"].seek(0) - - def read_step(self, step): - self["instance"].seek(self._headerSize + step * self._frameSize) - - data = self["instance"].read(self._configHeaderSize).splitlines() - - line = data[0].split() - currentStep = int(line[1]) - - timeStep = (currentStep - self._firstStep) * self._timeStep - if self["imcon"] > 0: - cell = " ".join([i.decode("UTF-8") for i in data[1:]]).split() - cell = np.array(cell, dtype=np.float64) - cell = np.reshape(cell, (3, 3)).T - cell *= measure(1.0, "ang").toval("nm") - else: - cell = None - - data = np.array(self["instance"].read(self._configSize).split()) - - mask = np.ones((len(data),), dtype=bool) - mask[0 :: self._maskStep] = False - mask[1 :: self._maskStep] = False - mask[2 :: self._maskStep] = False - mask[3 :: self._maskStep] = False - if (self["version"] == "3") or (self["version"] == "4"): - mask[4 :: self._maskStep] = False - - config = np.array(np.compress(mask, data), dtype=np.float64) - - config = np.reshape(config, (self["natms"], 3 * (self["keytrj"] + 1))) - - config[:, 0:3] *= measure(1.0, "ang").toval("nm") - - # Case of the velocities - if self["keytrj"] == 1: - config[:, 3:6] *= measure(1.0, "ang/ps").toval("nm/ps") - - # Case of the velocities + gradients - elif self["keytrj"] == 2: - config[:, 3:6] *= measure(1.0, "ang/ps").toval("nm/ps") - config[:, 6:9] *= measure(1.0, "uma ang / ps2").toval("uma nm / ps2") - - return timeStep, cell, config - - def close(self): - self["instance"].close() - - def determine_version(self): - """Determine the DL_POLY version from the history file based - on record 1 and 2. See the DL_POLY 2, 3 and 4 manuals. - - Returns - ------- - str - The DL_POLY version. - - Raises - ------ - HistoryFileError - When the history file does not appear valid. - """ - lines = self["instance"].readlines() - self["instance"].seek(0, 0) - record_1 = lines[0] - record_2 = lines[1] - if len(record_1) in [73, 74]: - if len(record_2.split()) == 5: - return "4" - elif len(record_2.split()) == 3: - return "3" - elif len(record_1) in [81, 82]: - return "2" - - raise HistoryFileError("Invalid DLPOLY history file") - - -class DL_POLY(Converter): - """ - Converts a DL_POLY trajectory to a HDF trajectory. - """ - - label = "DL-POLY" - - settings = collections.OrderedDict() - settings["field_file"] = ( - "FieldFileConfigurator", - { - "wildcard": "FIELD files (FIELD*)|FIELD*|All files|*", - "default": "INPUT_FILENAME", - "label": "Input FIELD file", - }, - ) - settings["history_file"] = ( - "InputFileConfigurator", - { - "wildcard": "HISTORY files (HISTORY*)|HISTORY*|All files|*", - "default": "INPUT_FILENAME", - "label": "Input HISTORY file", - }, - ) - settings["atom_aliases"] = ( - "AtomMappingConfigurator", - { - "default": "{}", - "label": "Atom mapping", - "dependencies": {"input_file": "field_file"}, - }, - ) - settings["fold"] = ( - "BooleanConfigurator", - {"default": False, "label": "Fold coordinates into box"}, - ) - # settings['output_files'] = ('output_files', {'formats':["HDFFormat"]}) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - { - "formats": ["MDTFormat"], - "root": "history_file", - "label": "MDANSE trajectory (filename, format)", - }, - ) - - def initialize(self): - """ - Initialize the job. - """ - - self._atomicAliases = self.configuration["atom_aliases"]["value"] - - self._fieldFile = self.configuration["field_file"] - - self._historyFile = HistoryFile(self.configuration["history_file"]["filename"]) - - # The number of steps of the analysis. - self.numberOfSteps = int(self._historyFile["n_frames"]) - - self._chemicalSystem = ChemicalSystem() - - self._fieldFile.build_chemical_system(self._chemicalSystem, self._atomicAliases) - - self._trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - self._chemicalSystem, - self.numberOfSteps, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - self._velocities = None - - self._gradients = None - - def run_step(self, index): - """Runs a single step of the job. - - @param index: the index of the step. - @type index: int. - - @note: the argument index is the index of the loop note the index of the frame. - """ - - # The x, y and z values of the current frame. - time, unitCell, config = self._historyFile.read_step(index) - - unitCell = UnitCell(unitCell) - - if self._historyFile["imcon"] > 0: - conf = PeriodicRealConfiguration( - self._trajectory.chemical_system, config[:, 0:3], unitCell - ) - else: - conf = RealConfiguration(self._trajectory.chemical_system, config[:, 0:3]) - - if self.configuration["fold"]["value"]: - conf.fold_coordinates() - - if self._velocities is not None: - conf["velocities"] = config[:, 3:6] - - if self._gradients is not None: - conf["gradients"] = config[:, 6:9] - - self._trajectory.chemical_system.configuration = conf - - self._trajectory.dump_configuration( - time, - units={ - "time": "ps", - "unit_cell": "nm", - "coordinates": "nm", - "velocities": "nm/ps", - "gradients": "uma nm/ps2", - }, - ) - - return index, None - - def combine(self, index, x): - """ - @param index: the index of the step. - @type index: int. - - @param x: - @type x: any. - """ - - pass - - def finalize(self): - """ - Finalize the job. - """ - - self._historyFile.close() - - # Close the output trajectory. - self._trajectory.close() - - super(DL_POLY, self).finalize() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +import collections +import numpy as np + +from MDANSE.Chemistry.ChemicalEntity import ChemicalSystem +from MDANSE.Core.Error import Error +from MDANSE.Framework.Converters.Converter import Converter +from MDANSE.Framework.Units import measure +from MDANSE.MolecularDynamics.Configuration import ( + PeriodicRealConfiguration, + RealConfiguration, +) +from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter +from MDANSE.MolecularDynamics.UnitCell import UnitCell + + +_HISTORY_FORMAT = {} +_HISTORY_FORMAT["2"] = { + "rec1": 81, + "rec2": 31, + "reci": 61, + "recii": 37, + "reciii": 37, + "reciv": 37, + "reca": 43, + "recb": 37, + "recc": 37, + "recd": 37, +} +_HISTORY_FORMAT["3"] = { + "rec1": 73, + "rec2": 73, + "reci": 73, + "recii": 73, + "reciii": 73, + "reciv": 73, + "reca": 73, + "recb": 73, + "recc": 73, + "recd": 73, +} +_HISTORY_FORMAT["4"] = { + "rec1": 73, + "rec2": 73, + "reci": 73, + "recii": 73, + "reciii": 73, + "reciv": 73, + "reca": 73, + "recb": 73, + "recc": 73, + "recd": 73, +} + + +class HistoryFileError(Error): + pass + + +class DL_POLYConverterError(Error): + pass + + +class HistoryFile(dict): + + def __init__(self, filename): + super().__init__() + self["instance"] = open(filename, "rb") + + version = self.determine_version() + self["version"] = version + + lenTestLine = len(self["instance"].readline()) + + self["instance"].seek(0, 0) + + offset = lenTestLine - _HISTORY_FORMAT[self["version"]]["rec1"] + + self._headerSize = ( + _HISTORY_FORMAT[self["version"]]["rec1"] + + _HISTORY_FORMAT[self["version"]]["rec2"] + + 2 * offset + ) + + self["instance"].read(_HISTORY_FORMAT[self["version"]]["rec1"] + offset) + + data = self["instance"].read(_HISTORY_FORMAT[self["version"]]["rec2"] + offset) + + self["keytrj"], self["imcon"], self["natms"] = [ + int(v) for v in data.split()[0:3] + ] + + if self["keytrj"] not in list(range(3)): + raise HistoryFileError("Invalid value for trajectory output key.") + + if self["imcon"] not in list(range(4)): + raise HistoryFileError( + "Invalid value for periodic boundary conditions key." + ) + + if self["imcon"] == 0: + self._configHeaderSize = _HISTORY_FORMAT[self["version"]]["reci"] + else: + self._configHeaderSize = ( + _HISTORY_FORMAT[self["version"]]["reci"] + + 3 * _HISTORY_FORMAT[self["version"]]["recii"] + + 4 * offset + ) + + self._configSize = ( + _HISTORY_FORMAT[self["version"]]["reca"] + + offset + + (self["keytrj"] + 1) * (_HISTORY_FORMAT[self["version"]]["recb"] + offset) + ) * self["natms"] + + self._frameSize = self._configHeaderSize + self._configSize + + self["instance"].seek(0, 2) + + self["n_frames"] = ( + self["instance"].tell() - self._headerSize + ) / self._frameSize + + self["instance"].seek(self._headerSize) + + data = self["instance"].read(self._configHeaderSize).splitlines() + + line = data[0].split() + + self._firstStep = int(line[1]) + + self._timeStep = float(line[5]) + + self._maskStep = 3 + 3 * (self["keytrj"] + 1) + 1 + + if (self["version"] == "3") or (self["version"] == "4"): + self._maskStep += 1 + + self["instance"].seek(0) + + def read_step(self, step): + self["instance"].seek(self._headerSize + step * self._frameSize) + + data = self["instance"].read(self._configHeaderSize).splitlines() + + line = data[0].split() + currentStep = int(line[1]) + + timeStep = (currentStep - self._firstStep) * self._timeStep + if self["imcon"] > 0: + cell = " ".join([i.decode("UTF-8") for i in data[1:]]).split() + cell = np.array(cell, dtype=np.float64) + cell = np.reshape(cell, (3, 3)).T + cell *= measure(1.0, "ang").toval("nm") + else: + cell = None + + data = np.array(self["instance"].read(self._configSize).split()) + + mask = np.ones((len(data),), dtype=bool) + mask[0 :: self._maskStep] = False + mask[1 :: self._maskStep] = False + mask[2 :: self._maskStep] = False + mask[3 :: self._maskStep] = False + if (self["version"] == "3") or (self["version"] == "4"): + mask[4 :: self._maskStep] = False + + config = np.array(np.compress(mask, data), dtype=np.float64) + + config = np.reshape(config, (self["natms"], 3 * (self["keytrj"] + 1))) + + config[:, 0:3] *= measure(1.0, "ang").toval("nm") + + # Case of the velocities + if self["keytrj"] == 1: + config[:, 3:6] *= measure(1.0, "ang/ps").toval("nm/ps") + + # Case of the velocities + gradients + elif self["keytrj"] == 2: + config[:, 3:6] *= measure(1.0, "ang/ps").toval("nm/ps") + config[:, 6:9] *= measure(1.0, "uma ang / ps2").toval("uma nm / ps2") + + return timeStep, cell, config + + def close(self): + self["instance"].close() + + def determine_version(self): + """Determine the DL_POLY version from the history file based + on record 1 and 2. See the DL_POLY 2, 3 and 4 manuals. + + Returns + ------- + str + The DL_POLY version. + + Raises + ------ + HistoryFileError + When the history file does not appear valid. + """ + lines = self["instance"].readlines() + self["instance"].seek(0, 0) + record_1 = lines[0] + record_2 = lines[1] + if len(record_1) in [73, 74]: + if len(record_2.split()) == 5: + return "4" + elif len(record_2.split()) == 3: + return "3" + elif len(record_1) in [81, 82]: + return "2" + + raise HistoryFileError("Invalid DLPOLY history file") + + +class DL_POLY(Converter): + """ + Converts a DL_POLY trajectory to a HDF trajectory. + """ + + label = "DL-POLY" + + settings = collections.OrderedDict() + settings["field_file"] = ( + "FieldFileConfigurator", + { + "wildcard": "FIELD files (FIELD*)|FIELD*|All files|*", + "default": "INPUT_FILENAME", + "label": "Input FIELD file", + }, + ) + settings["history_file"] = ( + "InputFileConfigurator", + { + "wildcard": "HISTORY files (HISTORY*)|HISTORY*|All files|*", + "default": "INPUT_FILENAME", + "label": "Input HISTORY file", + }, + ) + settings["atom_aliases"] = ( + "AtomMappingConfigurator", + { + "default": "{}", + "label": "Atom mapping", + "dependencies": {"input_file": "field_file"}, + }, + ) + settings["fold"] = ( + "BooleanConfigurator", + {"default": False, "label": "Fold coordinates into box"}, + ) + # settings['output_files'] = ('output_files', {'formats':["HDFFormat"]}) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + { + "formats": ["MDTFormat"], + "root": "history_file", + "label": "MDANSE trajectory (filename, format)", + }, + ) + + def initialize(self): + """ + Initialize the job. + """ + + self._atomicAliases = self.configuration["atom_aliases"]["value"] + + self._fieldFile = self.configuration["field_file"] + + self._historyFile = HistoryFile(self.configuration["history_file"]["filename"]) + + # The number of steps of the analysis. + self.numberOfSteps = int(self._historyFile["n_frames"]) + + self._chemicalSystem = ChemicalSystem() + + self._fieldFile.build_chemical_system(self._chemicalSystem, self._atomicAliases) + + self._trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + self._chemicalSystem, + self.numberOfSteps, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + self._velocities = None + + self._gradients = None + + def run_step(self, index): + """Runs a single step of the job. + + @param index: the index of the step. + @type index: int. + + @note: the argument index is the index of the loop note the index of the frame. + """ + + # The x, y and z values of the current frame. + time, unitCell, config = self._historyFile.read_step(index) + + unitCell = UnitCell(unitCell) + + if self._historyFile["imcon"] > 0: + conf = PeriodicRealConfiguration( + self._trajectory.chemical_system, config[:, 0:3], unitCell + ) + else: + conf = RealConfiguration(self._trajectory.chemical_system, config[:, 0:3]) + + if self.configuration["fold"]["value"]: + conf.fold_coordinates() + + if self._velocities is not None: + conf["velocities"] = config[:, 3:6] + + if self._gradients is not None: + conf["gradients"] = config[:, 6:9] + + self._trajectory.chemical_system.configuration = conf + + self._trajectory.dump_configuration( + time, + units={ + "time": "ps", + "unit_cell": "nm", + "coordinates": "nm", + "velocities": "nm/ps", + "gradients": "uma nm/ps2", + }, + ) + + return index, None + + def combine(self, index, x): + """ + @param index: the index of the step. + @type index: int. + + @param x: + @type x: any. + """ + + pass + + def finalize(self): + """ + Finalize the job. + """ + + self._historyFile.close() + + # Close the output trajectory. + self._trajectory.close() + + super(DL_POLY, self).finalize() diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DMol.py b/MDANSE/Src/MDANSE/Framework/Converters/DMol.py index f47c1dc2f4..e4ad170f11 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DMol.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DMol.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/DMol.py -# @brief Implements module/class/test DMol +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Converters.Discover import Discover diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Discover.py b/MDANSE/Src/MDANSE/Framework/Converters/Discover.py index 3a9b6362ae..e739b13472 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Discover.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Discover.py @@ -1,393 +1,397 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file MDANSE/Framework/Jobs/Discover.py -# @brief Implements module/class/test Discover -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -import collections -import struct -import numpy as np - -from MDANSE.Framework.Converters.Converter import Converter -from MDANSE.Framework.Units import measure -from MDANSE.MolecularDynamics.Configuration import ( - PeriodicRealConfiguration, - RealConfiguration, -) -from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter -from MDANSE.MolecularDynamics.UnitCell import UnitCell - - -class HisFile(dict): - def __init__(self, hisfilename): - self["instance"] = open(hisfilename, "rb") - - self.parse_header() - - def parse_header(self): - hisfile = self["instance"] - - # Record 1 - rec = "!4x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - rec = "!i8x" - self._rec1Size = struct.calcsize(rec) - hisfile.read(self._rec1Size) - - # Record 2 - rec = "!80sd8x" - recSize = struct.calcsize(rec) - VERSION_INFO, VERSION = struct.unpack(rec, hisfile.read(recSize)) - VERSION_INFO = VERSION_INFO.strip() - - # Record 3+4 - rec = "!80s8x80s8x" - recSize = struct.calcsize(rec) - self["title"] = struct.unpack(rec, hisfile.read(recSize)) - self["title"] = "\n".join([t.decode("utf-8") for t in self["title"]]) - - # Record 5 - rec = "!i" - recSize = struct.calcsize(rec) - N_ATTYP = struct.unpack(rec, hisfile.read(recSize))[0] - rec = "!" + "%ds" % (4 * N_ATTYP) + "%dd" % N_ATTYP + "8x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - # Record 6 - rec = "!i" - recSize = struct.calcsize(rec) - N_NMRES = struct.unpack(rec, hisfile.read(recSize))[0] - rec = "!" + "%ds" % (4 * N_NMRES) + "8x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - # Record 7 - rec = "!i" - recSize = struct.calcsize(rec) - self["n_atoms"] = N_ATOMS = struct.unpack(rec, hisfile.read(recSize))[0] - rec = "!" + "%di" % N_ATOMS - if VERSION < 2.9: - rec += "%ds" % (4 * N_ATOMS) - else: - rec += "%ds" % (5 * N_ATOMS) - rec += "8x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - # Record 8 - rec = "!ii" - recSize = struct.calcsize(rec) - _, N_MOVAT = struct.unpack(rec, hisfile.read(recSize)) - if VERSION >= 2.6: - rec = "!" + "%di" % N_MOVAT - recSize = struct.calcsize(rec) - self["movable_atoms"] = ( - np.array(struct.unpack(rec, hisfile.read(recSize)), dtype=np.int32) - 1 - ) - else: - self["movable_atoms"] = list(range(self["n_atoms"])) - rec = "!8x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - # Record 9 - rec = "!i" - recSize = struct.calcsize(rec) - N_MOL = struct.unpack(rec, hisfile.read(recSize))[0] - rec = "!" + "%di" % N_MOL + "%di" % N_MOL + "8x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - # Record 10 - rec = "!i" - recSize = struct.calcsize(rec) - N_RES = struct.unpack(rec, hisfile.read(recSize))[0] - rec = "!" + "%di" % (2 * N_RES) + "%di" % N_RES + "8x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - # Record 11 - rec = "!i" - recSize = struct.calcsize(rec) - N_BONDS = struct.unpack(rec, hisfile.read(recSize))[0] - if N_BONDS > 0: - rec = "!" + "%di" % (2 * N_BONDS) - recSize = struct.calcsize(rec) - _ = struct.unpack(rec, hisfile.read(recSize)) - rec = "!8x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - # Record 12 - rec = "!6d" - recSize = struct.calcsize(rec) - _ = struct.unpack(rec, hisfile.read(recSize)) - rec = "!9d" - recSize = struct.calcsize(rec) - self["initial_cell"] = np.reshape( - np.array(struct.unpack(rec, hisfile.read(recSize)), dtype=np.float64), - (3, 3), - ) * measure(1.0, "ang").toval("nm") - - rec = "!4134di4di6d6i8x" - recSize = struct.calcsize(rec) - hisfile.read(recSize) - - # Record 13 - rec = "!idii8x" - recSize = struct.calcsize(rec) - N_ENER, TIME_STEP, _, _ = struct.unpack(rec, hisfile.read(recSize)) - self["time_step"] = TIME_STEP * measure(1.0, "fs").toval("ps") - - # Record 14 - rec = ( - "!3d" - + "%dd" % N_ENER - + "%dd" % N_MOL - + "%dd" % (N_MOL * N_ENER) - + "%dd" % (4 * N_MOL + 2 + 54) - + "8x" - ) - self._rec14Size = struct.calcsize(rec) - hisfile.read(self._rec14Size) - - # Record 15 - rec = "!" + "%df" % (3 * N_ATOMS) + "8x" - recSize = struct.calcsize(rec) - self["initial_coordinates"] = np.reshape( - struct.unpack(rec, hisfile.read(recSize)), (N_ATOMS, 3) - ) - self["initial_coordinates"] *= measure(1.0, "ang").toval("nm") - - # Record 16 - rec = "!" + "%df" % (3 * N_ATOMS) + "8x" - recSize = struct.calcsize(rec) - self["initial_velocities"] = np.reshape( - struct.unpack(rec, hisfile.read(recSize)), (N_ATOMS, 3) - ) - self["initial_velocities"] *= measure(1.0, "ang / fs").toval("nm/ps") - - self._headerSize = hisfile.tell() - - self._recN2 = "!15d8x" - self._recN2Size = struct.calcsize(self._recN2) - - if VERSION < 2.6: - self["n_movable_atoms"] = N_ATOMS - else: - self["n_movable_atoms"] = N_MOVAT - self._recCoord = "!" + "%df" % (3 * self["n_movable_atoms"]) + "8x" - self._recCoordSize = struct.calcsize(self._recCoord) - self._recVel = "!" + "%df" % (3 * self["n_movable_atoms"]) + "8x" - self._recVelSize = struct.calcsize(self._recVel) - - self._frameSize = ( - self._rec1Size - + self._rec14Size - + self._recN2Size - + self._recCoordSize - + self._recVelSize - ) - - hisfile.seek(0, 2) - - self["n_frames"] = (hisfile.tell() - self._headerSize) // self._frameSize - - def read_step(self, index): - hisfile = self["instance"] - - time = index * self["time_step"] - - hisfile.seek( - self._headerSize - + index * self._frameSize - + self._rec1Size - + self._rec14Size - ) - - cell = np.reshape( - np.array(struct.unpack(self._recN2, hisfile.read(self._recN2Size))[6:]), - (3, 3), - ) * measure(1.0, "ang").toval("nm") - - coords = np.reshape( - struct.unpack(self._recCoord, hisfile.read(self._recCoordSize)), - (self["n_movable_atoms"], 3), - ) - coords *= measure(1.0, "ang").toval("nm") - - vels = np.reshape( - struct.unpack(self._recVel, hisfile.read(self._recVelSize)), - (self["n_movable_atoms"], 3), - ) - vels *= measure(1.0, "ang / fs").toval("nm/ps") - - return time, cell, coords, vels - - def close(self): - self["instance"].close() - - -class Discover(Converter): - """ - Converts a Discover trajectory to a HDF trajectory. - """ - - label = "Discover" - - category = ("Converters", "Materials Studio") - - settings = collections.OrderedDict() - settings["xtd_file"] = ( - "XTDFileConfigurator", - { - "wildcard": "XTD files (*.xtd)|*.xtd|All files|*", - "default": "INPUT_FILENAME.xtd", - "label": "Input XTD file", - }, - ) - settings["his_file"] = ( - "InputFileConfigurator", - { - "wildcard": "HIS files (*.his)|*.his|All files|*", - "default": "INPUT_FILENAME.his", - "label": "Input HIS file", - }, - ) - settings["atom_aliases"] = ( - "AtomMappingConfigurator", - { - "default": "{}", - "label": "Atom mapping", - "dependencies": {"input_file": "xtd_file"}, - }, - ) - settings["fold"] = ( - "BooleanConfigurator", - {"default": False, "label": "Fold coordinates into box"}, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - { - "formats": ["MDTFormat"], - "root": "xtd_file", - "label": "MDANSE trajectory (filename, format)", - }, - ) - - def initialize(self): - """ - Initialize the job. - """ - self._atomicAliases = self.configuration["atom_aliases"]["value"] - - self._xtdfile = self.configuration["xtd_file"] - - self._xtdfile.build_chemical_system(self._atomicAliases) - - self._chemicalSystem = self._xtdfile.chemicalSystem - - self._hisfile = HisFile(self.configuration["his_file"]["filename"]) - - # The number of steps of the analysis. - self.numberOfSteps = self._hisfile["n_frames"] - - variables = {} - variables["velocities"] = self._hisfile["initial_velocities"] - - if self._chemicalSystem.configuration.is_periodic: - unitCell = UnitCell(self._hisfile["initial_cell"]) - realConf = PeriodicRealConfiguration( - self._chemicalSystem, - self._hisfile["initial_coordinates"], - unitCell, - **variables, - ) - else: - realConf = RealConfiguration( - self._chemicalSystem, self._hisfile["initial_coordinates"], **variables - ) - - if self.configuration["fold"]["value"]: - realConf.fold_coordinates() - - self._chemicalSystem.configuration = realConf - - # A trajectory is opened for writing. - self._trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - self._chemicalSystem, - self.numberOfSteps, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - def run_step(self, index): - """Runs a single step of the job. - - @param index: the index of the step. - @type index: int. - - @note: the argument index is the index of the loop note the index of the frame. - """ - - time, cell, config, vel = self._hisfile.read_step(index) - - conf = self._trajectory.chemical_system.configuration - if conf.is_periodic: - conf.unit_cell = UnitCell(cell) - - movableAtoms = self._hisfile["movable_atoms"] - - conf["coordinates"][movableAtoms, :] = config - conf["velocities"][movableAtoms, :] = vel - - conf.fold_coordinates() - - self._trajectory.chemical_system.configuration = conf - - self._trajectory.dump_configuration( - time, - units={ - "time": "ps", - "unit_cell": "nm", - "coordinates": "nm", - "velocities": "nm/ps", - }, - ) - - return index, None - - def combine(self, index, x): - """ - @param index: the index of the step. - @type index: int. - - @param x: - @type x: any. - """ - - pass - - def finalize(self): - """ - Finalize the job. - """ - - self._hisfile.close() - - # Close the output trajectory. - self._trajectory.close() - - super(Discover, self).finalize() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +import collections +import struct +import numpy as np + +from MDANSE.Framework.Converters.Converter import Converter +from MDANSE.Framework.Units import measure +from MDANSE.MolecularDynamics.Configuration import ( + PeriodicRealConfiguration, + RealConfiguration, +) +from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter +from MDANSE.MolecularDynamics.UnitCell import UnitCell + + +class HisFile(dict): + def __init__(self, hisfilename): + self["instance"] = open(hisfilename, "rb") + + self.parse_header() + + def parse_header(self): + hisfile = self["instance"] + + # Record 1 + rec = "!4x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + rec = "!i8x" + self._rec1Size = struct.calcsize(rec) + hisfile.read(self._rec1Size) + + # Record 2 + rec = "!80sd8x" + recSize = struct.calcsize(rec) + VERSION_INFO, VERSION = struct.unpack(rec, hisfile.read(recSize)) + VERSION_INFO = VERSION_INFO.strip() + + # Record 3+4 + rec = "!80s8x80s8x" + recSize = struct.calcsize(rec) + self["title"] = struct.unpack(rec, hisfile.read(recSize)) + self["title"] = "\n".join([t.decode("utf-8") for t in self["title"]]) + + # Record 5 + rec = "!i" + recSize = struct.calcsize(rec) + N_ATTYP = struct.unpack(rec, hisfile.read(recSize))[0] + rec = "!" + "%ds" % (4 * N_ATTYP) + "%dd" % N_ATTYP + "8x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + # Record 6 + rec = "!i" + recSize = struct.calcsize(rec) + N_NMRES = struct.unpack(rec, hisfile.read(recSize))[0] + rec = "!" + "%ds" % (4 * N_NMRES) + "8x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + # Record 7 + rec = "!i" + recSize = struct.calcsize(rec) + self["n_atoms"] = N_ATOMS = struct.unpack(rec, hisfile.read(recSize))[0] + rec = "!" + "%di" % N_ATOMS + if VERSION < 2.9: + rec += "%ds" % (4 * N_ATOMS) + else: + rec += "%ds" % (5 * N_ATOMS) + rec += "8x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + # Record 8 + rec = "!ii" + recSize = struct.calcsize(rec) + _, N_MOVAT = struct.unpack(rec, hisfile.read(recSize)) + if VERSION >= 2.6: + rec = "!" + "%di" % N_MOVAT + recSize = struct.calcsize(rec) + self["movable_atoms"] = ( + np.array(struct.unpack(rec, hisfile.read(recSize)), dtype=np.int32) - 1 + ) + else: + self["movable_atoms"] = list(range(self["n_atoms"])) + rec = "!8x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + # Record 9 + rec = "!i" + recSize = struct.calcsize(rec) + N_MOL = struct.unpack(rec, hisfile.read(recSize))[0] + rec = "!" + "%di" % N_MOL + "%di" % N_MOL + "8x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + # Record 10 + rec = "!i" + recSize = struct.calcsize(rec) + N_RES = struct.unpack(rec, hisfile.read(recSize))[0] + rec = "!" + "%di" % (2 * N_RES) + "%di" % N_RES + "8x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + # Record 11 + rec = "!i" + recSize = struct.calcsize(rec) + N_BONDS = struct.unpack(rec, hisfile.read(recSize))[0] + if N_BONDS > 0: + rec = "!" + "%di" % (2 * N_BONDS) + recSize = struct.calcsize(rec) + _ = struct.unpack(rec, hisfile.read(recSize)) + rec = "!8x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + # Record 12 + rec = "!6d" + recSize = struct.calcsize(rec) + _ = struct.unpack(rec, hisfile.read(recSize)) + rec = "!9d" + recSize = struct.calcsize(rec) + self["initial_cell"] = np.reshape( + np.array(struct.unpack(rec, hisfile.read(recSize)), dtype=np.float64), + (3, 3), + ) * measure(1.0, "ang").toval("nm") + + rec = "!4134di4di6d6i8x" + recSize = struct.calcsize(rec) + hisfile.read(recSize) + + # Record 13 + rec = "!idii8x" + recSize = struct.calcsize(rec) + N_ENER, TIME_STEP, _, _ = struct.unpack(rec, hisfile.read(recSize)) + self["time_step"] = TIME_STEP * measure(1.0, "fs").toval("ps") + + # Record 14 + rec = ( + "!3d" + + "%dd" % N_ENER + + "%dd" % N_MOL + + "%dd" % (N_MOL * N_ENER) + + "%dd" % (4 * N_MOL + 2 + 54) + + "8x" + ) + self._rec14Size = struct.calcsize(rec) + hisfile.read(self._rec14Size) + + # Record 15 + rec = "!" + "%df" % (3 * N_ATOMS) + "8x" + recSize = struct.calcsize(rec) + self["initial_coordinates"] = np.reshape( + struct.unpack(rec, hisfile.read(recSize)), (N_ATOMS, 3) + ) + self["initial_coordinates"] *= measure(1.0, "ang").toval("nm") + + # Record 16 + rec = "!" + "%df" % (3 * N_ATOMS) + "8x" + recSize = struct.calcsize(rec) + self["initial_velocities"] = np.reshape( + struct.unpack(rec, hisfile.read(recSize)), (N_ATOMS, 3) + ) + self["initial_velocities"] *= measure(1.0, "ang / fs").toval("nm/ps") + + self._headerSize = hisfile.tell() + + self._recN2 = "!15d8x" + self._recN2Size = struct.calcsize(self._recN2) + + if VERSION < 2.6: + self["n_movable_atoms"] = N_ATOMS + else: + self["n_movable_atoms"] = N_MOVAT + self._recCoord = "!" + "%df" % (3 * self["n_movable_atoms"]) + "8x" + self._recCoordSize = struct.calcsize(self._recCoord) + self._recVel = "!" + "%df" % (3 * self["n_movable_atoms"]) + "8x" + self._recVelSize = struct.calcsize(self._recVel) + + self._frameSize = ( + self._rec1Size + + self._rec14Size + + self._recN2Size + + self._recCoordSize + + self._recVelSize + ) + + hisfile.seek(0, 2) + + self["n_frames"] = (hisfile.tell() - self._headerSize) // self._frameSize + + def read_step(self, index): + hisfile = self["instance"] + + time = index * self["time_step"] + + hisfile.seek( + self._headerSize + + index * self._frameSize + + self._rec1Size + + self._rec14Size + ) + + cell = np.reshape( + np.array(struct.unpack(self._recN2, hisfile.read(self._recN2Size))[6:]), + (3, 3), + ) * measure(1.0, "ang").toval("nm") + + coords = np.reshape( + struct.unpack(self._recCoord, hisfile.read(self._recCoordSize)), + (self["n_movable_atoms"], 3), + ) + coords *= measure(1.0, "ang").toval("nm") + + vels = np.reshape( + struct.unpack(self._recVel, hisfile.read(self._recVelSize)), + (self["n_movable_atoms"], 3), + ) + vels *= measure(1.0, "ang / fs").toval("nm/ps") + + return time, cell, coords, vels + + def close(self): + self["instance"].close() + + +class Discover(Converter): + """ + Converts a Discover trajectory to a HDF trajectory. + """ + + label = "Discover" + + category = ("Converters", "Materials Studio") + + settings = collections.OrderedDict() + settings["xtd_file"] = ( + "XTDFileConfigurator", + { + "wildcard": "XTD files (*.xtd)|*.xtd|All files|*", + "default": "INPUT_FILENAME.xtd", + "label": "Input XTD file", + }, + ) + settings["his_file"] = ( + "InputFileConfigurator", + { + "wildcard": "HIS files (*.his)|*.his|All files|*", + "default": "INPUT_FILENAME.his", + "label": "Input HIS file", + }, + ) + settings["atom_aliases"] = ( + "AtomMappingConfigurator", + { + "default": "{}", + "label": "Atom mapping", + "dependencies": {"input_file": "xtd_file"}, + }, + ) + settings["fold"] = ( + "BooleanConfigurator", + {"default": False, "label": "Fold coordinates into box"}, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + { + "formats": ["MDTFormat"], + "root": "xtd_file", + "label": "MDANSE trajectory (filename, format)", + }, + ) + + def initialize(self): + """ + Initialize the job. + """ + self._atomicAliases = self.configuration["atom_aliases"]["value"] + + self._xtdfile = self.configuration["xtd_file"] + + self._xtdfile.build_chemical_system(self._atomicAliases) + + self._chemicalSystem = self._xtdfile.chemicalSystem + + self._hisfile = HisFile(self.configuration["his_file"]["filename"]) + + # The number of steps of the analysis. + self.numberOfSteps = self._hisfile["n_frames"] + + variables = {} + variables["velocities"] = self._hisfile["initial_velocities"] + + if self._chemicalSystem.configuration.is_periodic: + unitCell = UnitCell(self._hisfile["initial_cell"]) + realConf = PeriodicRealConfiguration( + self._chemicalSystem, + self._hisfile["initial_coordinates"], + unitCell, + **variables, + ) + else: + realConf = RealConfiguration( + self._chemicalSystem, self._hisfile["initial_coordinates"], **variables + ) + + if self.configuration["fold"]["value"]: + realConf.fold_coordinates() + + self._chemicalSystem.configuration = realConf + + # A trajectory is opened for writing. + self._trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + self._chemicalSystem, + self.numberOfSteps, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + def run_step(self, index): + """Runs a single step of the job. + + @param index: the index of the step. + @type index: int. + + @note: the argument index is the index of the loop note the index of the frame. + """ + + time, cell, config, vel = self._hisfile.read_step(index) + + conf = self._trajectory.chemical_system.configuration + if conf.is_periodic: + conf.unit_cell = UnitCell(cell) + + movableAtoms = self._hisfile["movable_atoms"] + + conf["coordinates"][movableAtoms, :] = config + conf["velocities"][movableAtoms, :] = vel + + conf.fold_coordinates() + + self._trajectory.chemical_system.configuration = conf + + self._trajectory.dump_configuration( + time, + units={ + "time": "ps", + "unit_cell": "nm", + "coordinates": "nm", + "velocities": "nm/ps", + }, + ) + + return index, None + + def combine(self, index, x): + """ + @param index: the index of the step. + @type index: int. + + @param x: + @type x: any. + """ + + pass + + def finalize(self): + """ + Finalize the job. + """ + + self._hisfile.close() + + # Close the output trajectory. + self._trajectory.close() + + super(Discover, self).finalize() diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py b/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py index ecade76371..549a8d3a3c 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py @@ -1,419 +1,423 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file MDANSE/Framework/Jobs/Forcite.py -# @brief Implements module/class/test Forcite -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -import collections -import struct - -import numpy as np - -from MDANSE.Framework.Units import measure -from MDANSE.Framework.Converters.Converter import Converter -from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter - - -FORCE_FACTOR = measure(1.0, "kcal_per_mole/ang", equivalent=True).toval( - "uma nm/ps2 mol" -) - - -class TrjFile(dict): - def __init__(self, trjfilename): - self["instance"] = open(trjfilename, "rb") - - self.parse_header() - - def parse_header(self): - trjfile = self["instance"] - - rec = "!4x" - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - # Record 1 - rec = "!4s20i8x" - recSize = struct.calcsize(rec) - DATA = struct.unpack(rec, trjfile.read(recSize)) - VERSION = DATA[1] - if VERSION < 2010: - self._fp = "f" - else: - self._fp = "d" - - # Diff with doc --> NTRJTI and TRJTIC not in doc - rec = "!i" - recSize = struct.calcsize(rec) - (NTRJTI,) = struct.unpack(rec, trjfile.read(recSize)) - rec = "!%ds8x" % (80 * NTRJTI) - recSize = struct.calcsize(rec) - self["title"] = struct.unpack(rec, trjfile.read(recSize)) - self["title"] = "\n".join([t.decode("utf-8") for t in self["title"]]) - - # Record 2 - rec = "!i" - recSize = struct.calcsize(rec) - NEEXTI = struct.unpack(rec, trjfile.read(recSize))[0] - rec = "!" + "%ds" % (80 * NEEXTI) + "8x" - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - # Record 3 - rec = "!8i8x" - recSize = struct.calcsize(rec) - PERTYPE, _, LCANON, DEFCEL, _, _, LNPECAN, LTMPDAMP = struct.unpack( - rec, trjfile.read(recSize) - ) - self["pertype"] = PERTYPE - self["defcel"] = DEFCEL - - # Record 4 - rec = "!i" - recSize = struct.calcsize(rec) - NFLUSD = struct.unpack(rec, trjfile.read(recSize))[0] - - rec = "!%di%di%ds8x" % (NFLUSD, NFLUSD, 8 * NFLUSD) - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - rec = "!i" - recSize = struct.calcsize(rec) - self["totmov"] = struct.unpack(rec, trjfile.read(recSize))[0] - - rec = "!%di8x" % self["totmov"] - recSize = struct.calcsize(rec) - self["mvofst"] = ( - np.array(struct.unpack(rec, trjfile.read(recSize)), dtype=np.int32) - 1 - ) - - # Record 4a - rec = "!i" - recSize = struct.calcsize(rec) - (LEEXTI,) = struct.unpack(rec, trjfile.read(recSize)) - rec = "!%ds8x" % LEEXTI - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - # Record 4b - rec = "!i" - recSize = struct.calcsize(rec) - (LPARTI,) = struct.unpack(rec, trjfile.read(recSize)) - rec = "!%ds8x" % LPARTI - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - self._headerSize = trjfile.tell() - - # Frame record 1 - if VERSION == 2000: - rec1 = "!%si33%s5i8x" % (self._fp, self._fp) - elif VERSION == 2010: - rec1 = "!%si57%s6i8x" % (self._fp, self._fp) - else: - rec1 = "!%si58%s6i8x" % (self._fp, self._fp) - - recSize = struct.calcsize(rec1) - DATA = struct.unpack(rec1, trjfile.read(recSize)) - - if VERSION < 2010: - self["velocities_written"] = DATA[-3] - self["gradients_written"] = 0 - else: - self["velocities_written"] = DATA[-4] - self["gradients_written"] = DATA[-3] - - # Frame record 2 - rec = "!12%s8x" % self._fp - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - # Frame record 3 - if LCANON: - rec = "!4%s8x" % self._fp - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - if PERTYPE > 0: - # Frame record 4 - self._defCellRecPos = trjfile.tell() - self._headerSize - self._defCellRec = "!22%s8x" % self._fp - self._defCellRecSize = struct.calcsize(self._defCellRec) - trjfile.read(self._defCellRecSize) - - if PERTYPE > 0: - # Frame record 5 - rec = "!i14%s8x" % self._fp - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - if LNPECAN: - # Frame record 6 - rec = "!3%s8x" % self._fp - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - if LTMPDAMP: - # Frame record 7 - rec = "!%s8x" % self._fp - recSize = struct.calcsize(rec) - trjfile.read(recSize) - - self._configRecPos = trjfile.tell() - self._headerSize - - if self["velocities_written"]: - if self["gradients_written"]: - # Frame record 8,9,10,11,12,13,14,15,16 - self._configRec = "!" + ("%d%s8x" * 9) % ( - (self["totmov"], self._fp) * 9 - ) - else: - # Frame record 8,9,10,11,12,13 - self._configRec = "!" + ("%d%s8x" * 6) % ( - (self["totmov"], self._fp) * 6 - ) - else: - if self["gradients_written"]: - # Frame record 8,9,10,14,15,16 - self._configRec = "!" + ("%d%s8x" * 6) % ( - (self["totmov"], self._fp) * 6 - ) - else: - # Frame record 8,9,10 - self._configRec = "!" + ("%d%s8x" * 3) % ( - (self["totmov"], self._fp) * 3 - ) - - self._configRecSize = struct.calcsize(self._configRec) - trjfile.read(self._configRecSize) - - self._frameSize = trjfile.tell() - self._headerSize - - trjfile.seek(0, 2) - - self["n_frames"] = (trjfile.tell() - self._headerSize) // self._frameSize - - def read_step(self, index): - """ """ - - trjfile = self["instance"] - - pos = self._headerSize + index * self._frameSize - - trjfile.seek(pos, 0) - - rec = "!%s" % self._fp - recSize = struct.calcsize(rec) - (timeStep,) = struct.unpack(rec, trjfile.read(recSize)) - - if self["defcel"]: - trjfile.seek(pos + self._defCellRecPos, 0) - cell = np.zeros((3, 3), dtype=np.float64) - # ax,by,cz,bz,az,ay - cellData = np.array( - struct.unpack(self._defCellRec, trjfile.read(self._defCellRecSize)), - dtype=np.float64, - )[2:8] * measure(1.0, "ang").toval("nm") - cell[0, 0] = cellData[0] - cell[1, 1] = cellData[1] - cell[2, 2] = cellData[2] - cell[1, 2] = cellData[3] - cell[0, 2] = cellData[4] - cell[0, 1] = cellData[5] - - else: - cell = None - - trjfile.seek(pos + self._configRecPos, 0) - - config = struct.unpack(self._configRec, trjfile.read(self._configRecSize)) - - if self["velocities_written"]: - if self["gradients_written"]: - config = np.transpose(np.reshape(config, (3, 3, self["totmov"]))) - xyz = config[:, :, 0] * measure(1.0, "ang").toval("nm") - vel = config[:, :, 1] * measure(1.0, "ang/fs").toval("nm/ps") - gradients = config[:, :, 2] * FORCE_FACTOR - else: - config = np.transpose(np.reshape(config, (2, 3, self["totmov"]))) - xyz = config[:, :, 0] * measure(1.0, "ang").toval("nm") - vel = config[:, :, 1] * measure(1.0, "ang/fs").toval("nm/ps") - gradients = None - else: - if self["gradients_written"]: - config = np.transpose(np.reshape(config, (2, 3, self["totmov"]))) - xyz = config[:, :, 0] * measure(1.0, "ang").toval("nm") - vel = None - gradients = config[:, :, 1] * FORCE_FACTOR - else: - config = np.transpose(np.reshape(config, (1, 3, self["totmov"]))) - xyz = config[:, :, 0] * measure(1.0, "ang").toval("nm") - vel = None - gradients = None - - return timeStep, cell, xyz, vel, gradients - - def close(self): - self["instance"].close() - - -class Forcite(Converter): - """ - Converts a Forcite trajectory to a HDF trajectory. - """ - - label = "Forcite" - - category = ("Converters", "Materials Studio") - - settings = collections.OrderedDict() - settings["xtd_file"] = ( - "XTDFileConfigurator", - { - "wildcard": "XTD files (*.xtd)|*.xtd|All files|*", - "default": "INPUT_FILENAME.xtd", - "label": "Input XTD file", - }, - ) - settings["trj_file"] = ( - "InputFileConfigurator", - { - "wildcard": "TRJ files (*.trj)|*.trj|All files|*", - "default": "INPUT_FILENAME.trj", - "label": "Input TRJ file", - }, - ) - settings["atom_aliases"] = ( - "AtomMappingConfigurator", - { - "default": "{}", - "label": "Atom mapping", - "dependencies": {"input_file": "xtd_file"}, - }, - ) - settings["fold"] = ( - "BooleanConfigurator", - {"default": False, "label": "Fold coordinates into box"}, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - { - "formats": ["MDTFormat"], - "root": "xtd_file", - "label": "MDANSE trajectory (filename, format)", - }, - ) - - def initialize(self): - """ - Initialize the job. - """ - self._atomicAliases = self.configuration["atom_aliases"]["value"] - - self._xtdfile = self.configuration["xtd_file"] - - self._xtdfile.build_chemical_system(self._atomicAliases) - - self._chemicalSystem = self._xtdfile.chemicalSystem - - self._trjfile = TrjFile(self.configuration["trj_file"]["filename"]) - - # The number of steps of the analysis. - self.numberOfSteps = self._trjfile["n_frames"] - - if self._trjfile["velocities_written"]: - self._velocities = np.zeros( - (self._chemicalSystem.number_of_atoms, 3), dtype=np.float64 - ) - else: - self._velocities = None - - if self._trjfile["gradients_written"]: - self._gradients = np.zeros( - (self._chemicalSystem.number_of_atoms, 3), dtype=np.float64 - ) - else: - self._gradients = None - - # A trajectory is opened for writing. - self._trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - self._chemicalSystem, - self.numberOfSteps, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - def run_step(self, index): - """Runs a single step of the job. - - @param index: the index of the step. - @type index: int. - - @note: the argument index is the index of the loop note the index of the frame. - """ - - # The x, y and z values of the current frame. - time, cell, xyz, velocities, gradients = self._trjfile.read_step(index) - - # If the universe is periodic set its shape with the current dimensions of the unit cell. - conf = self._trajectory.chemical_system.configuration - movableAtoms = self._trjfile["mvofst"] - conf["coordinates"][movableAtoms, :] = xyz - if conf.is_periodic: - if self._trjfile["defcel"]: - conf.unit_cell = cell - if self._configuration["fold"]["value"]: - conf.fold_coordinates() - - if self._velocities is not None: - self._velocities[movableAtoms, :] = velocities - conf["velocities"] = self._velocities - - if self._gradients is not None: - self._gradients[movableAtoms, :] = gradients - conf["gradients"] = self._gradients - - self._trajectory.dump_configuration( - time, - units={ - "time": "ps", - "unit_cell": "nm", - "coordinates": "nm", - "velocities": "nm/ps", - "gradients": "uma nm/ps2", - }, - ) - - return index, None - - def combine(self, index, x): - """ - @param index: the index of the step. - @type index: int. - - @param x: - @type x: any. - """ - - pass - - def finalize(self): - """ - Finalize the job. - """ - - self._trjfile.close() - - # Close the output trajectory. - self._trajectory.close() - - super(Forcite, self).finalize() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +import collections +import struct + +import numpy as np + +from MDANSE.Framework.Units import measure +from MDANSE.Framework.Converters.Converter import Converter +from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter + + +FORCE_FACTOR = measure(1.0, "kcal_per_mole/ang", equivalent=True).toval( + "uma nm/ps2 mol" +) + + +class TrjFile(dict): + def __init__(self, trjfilename): + self["instance"] = open(trjfilename, "rb") + + self.parse_header() + + def parse_header(self): + trjfile = self["instance"] + + rec = "!4x" + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + # Record 1 + rec = "!4s20i8x" + recSize = struct.calcsize(rec) + DATA = struct.unpack(rec, trjfile.read(recSize)) + VERSION = DATA[1] + if VERSION < 2010: + self._fp = "f" + else: + self._fp = "d" + + # Diff with doc --> NTRJTI and TRJTIC not in doc + rec = "!i" + recSize = struct.calcsize(rec) + (NTRJTI,) = struct.unpack(rec, trjfile.read(recSize)) + rec = "!%ds8x" % (80 * NTRJTI) + recSize = struct.calcsize(rec) + self["title"] = struct.unpack(rec, trjfile.read(recSize)) + self["title"] = "\n".join([t.decode("utf-8") for t in self["title"]]) + + # Record 2 + rec = "!i" + recSize = struct.calcsize(rec) + NEEXTI = struct.unpack(rec, trjfile.read(recSize))[0] + rec = "!" + "%ds" % (80 * NEEXTI) + "8x" + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + # Record 3 + rec = "!8i8x" + recSize = struct.calcsize(rec) + PERTYPE, _, LCANON, DEFCEL, _, _, LNPECAN, LTMPDAMP = struct.unpack( + rec, trjfile.read(recSize) + ) + self["pertype"] = PERTYPE + self["defcel"] = DEFCEL + + # Record 4 + rec = "!i" + recSize = struct.calcsize(rec) + NFLUSD = struct.unpack(rec, trjfile.read(recSize))[0] + + rec = "!%di%di%ds8x" % (NFLUSD, NFLUSD, 8 * NFLUSD) + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + rec = "!i" + recSize = struct.calcsize(rec) + self["totmov"] = struct.unpack(rec, trjfile.read(recSize))[0] + + rec = "!%di8x" % self["totmov"] + recSize = struct.calcsize(rec) + self["mvofst"] = ( + np.array(struct.unpack(rec, trjfile.read(recSize)), dtype=np.int32) - 1 + ) + + # Record 4a + rec = "!i" + recSize = struct.calcsize(rec) + (LEEXTI,) = struct.unpack(rec, trjfile.read(recSize)) + rec = "!%ds8x" % LEEXTI + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + # Record 4b + rec = "!i" + recSize = struct.calcsize(rec) + (LPARTI,) = struct.unpack(rec, trjfile.read(recSize)) + rec = "!%ds8x" % LPARTI + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + self._headerSize = trjfile.tell() + + # Frame record 1 + if VERSION == 2000: + rec1 = "!%si33%s5i8x" % (self._fp, self._fp) + elif VERSION == 2010: + rec1 = "!%si57%s6i8x" % (self._fp, self._fp) + else: + rec1 = "!%si58%s6i8x" % (self._fp, self._fp) + + recSize = struct.calcsize(rec1) + DATA = struct.unpack(rec1, trjfile.read(recSize)) + + if VERSION < 2010: + self["velocities_written"] = DATA[-3] + self["gradients_written"] = 0 + else: + self["velocities_written"] = DATA[-4] + self["gradients_written"] = DATA[-3] + + # Frame record 2 + rec = "!12%s8x" % self._fp + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + # Frame record 3 + if LCANON: + rec = "!4%s8x" % self._fp + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + if PERTYPE > 0: + # Frame record 4 + self._defCellRecPos = trjfile.tell() - self._headerSize + self._defCellRec = "!22%s8x" % self._fp + self._defCellRecSize = struct.calcsize(self._defCellRec) + trjfile.read(self._defCellRecSize) + + if PERTYPE > 0: + # Frame record 5 + rec = "!i14%s8x" % self._fp + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + if LNPECAN: + # Frame record 6 + rec = "!3%s8x" % self._fp + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + if LTMPDAMP: + # Frame record 7 + rec = "!%s8x" % self._fp + recSize = struct.calcsize(rec) + trjfile.read(recSize) + + self._configRecPos = trjfile.tell() - self._headerSize + + if self["velocities_written"]: + if self["gradients_written"]: + # Frame record 8,9,10,11,12,13,14,15,16 + self._configRec = "!" + ("%d%s8x" * 9) % ( + (self["totmov"], self._fp) * 9 + ) + else: + # Frame record 8,9,10,11,12,13 + self._configRec = "!" + ("%d%s8x" * 6) % ( + (self["totmov"], self._fp) * 6 + ) + else: + if self["gradients_written"]: + # Frame record 8,9,10,14,15,16 + self._configRec = "!" + ("%d%s8x" * 6) % ( + (self["totmov"], self._fp) * 6 + ) + else: + # Frame record 8,9,10 + self._configRec = "!" + ("%d%s8x" * 3) % ( + (self["totmov"], self._fp) * 3 + ) + + self._configRecSize = struct.calcsize(self._configRec) + trjfile.read(self._configRecSize) + + self._frameSize = trjfile.tell() - self._headerSize + + trjfile.seek(0, 2) + + self["n_frames"] = (trjfile.tell() - self._headerSize) // self._frameSize + + def read_step(self, index): + """ """ + + trjfile = self["instance"] + + pos = self._headerSize + index * self._frameSize + + trjfile.seek(pos, 0) + + rec = "!%s" % self._fp + recSize = struct.calcsize(rec) + (timeStep,) = struct.unpack(rec, trjfile.read(recSize)) + + if self["defcel"]: + trjfile.seek(pos + self._defCellRecPos, 0) + cell = np.zeros((3, 3), dtype=np.float64) + # ax,by,cz,bz,az,ay + cellData = np.array( + struct.unpack(self._defCellRec, trjfile.read(self._defCellRecSize)), + dtype=np.float64, + )[2:8] * measure(1.0, "ang").toval("nm") + cell[0, 0] = cellData[0] + cell[1, 1] = cellData[1] + cell[2, 2] = cellData[2] + cell[1, 2] = cellData[3] + cell[0, 2] = cellData[4] + cell[0, 1] = cellData[5] + + else: + cell = None + + trjfile.seek(pos + self._configRecPos, 0) + + config = struct.unpack(self._configRec, trjfile.read(self._configRecSize)) + + if self["velocities_written"]: + if self["gradients_written"]: + config = np.transpose(np.reshape(config, (3, 3, self["totmov"]))) + xyz = config[:, :, 0] * measure(1.0, "ang").toval("nm") + vel = config[:, :, 1] * measure(1.0, "ang/fs").toval("nm/ps") + gradients = config[:, :, 2] * FORCE_FACTOR + else: + config = np.transpose(np.reshape(config, (2, 3, self["totmov"]))) + xyz = config[:, :, 0] * measure(1.0, "ang").toval("nm") + vel = config[:, :, 1] * measure(1.0, "ang/fs").toval("nm/ps") + gradients = None + else: + if self["gradients_written"]: + config = np.transpose(np.reshape(config, (2, 3, self["totmov"]))) + xyz = config[:, :, 0] * measure(1.0, "ang").toval("nm") + vel = None + gradients = config[:, :, 1] * FORCE_FACTOR + else: + config = np.transpose(np.reshape(config, (1, 3, self["totmov"]))) + xyz = config[:, :, 0] * measure(1.0, "ang").toval("nm") + vel = None + gradients = None + + return timeStep, cell, xyz, vel, gradients + + def close(self): + self["instance"].close() + + +class Forcite(Converter): + """ + Converts a Forcite trajectory to a HDF trajectory. + """ + + label = "Forcite" + + category = ("Converters", "Materials Studio") + + settings = collections.OrderedDict() + settings["xtd_file"] = ( + "XTDFileConfigurator", + { + "wildcard": "XTD files (*.xtd)|*.xtd|All files|*", + "default": "INPUT_FILENAME.xtd", + "label": "Input XTD file", + }, + ) + settings["trj_file"] = ( + "InputFileConfigurator", + { + "wildcard": "TRJ files (*.trj)|*.trj|All files|*", + "default": "INPUT_FILENAME.trj", + "label": "Input TRJ file", + }, + ) + settings["atom_aliases"] = ( + "AtomMappingConfigurator", + { + "default": "{}", + "label": "Atom mapping", + "dependencies": {"input_file": "xtd_file"}, + }, + ) + settings["fold"] = ( + "BooleanConfigurator", + {"default": False, "label": "Fold coordinates into box"}, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + { + "formats": ["MDTFormat"], + "root": "xtd_file", + "label": "MDANSE trajectory (filename, format)", + }, + ) + + def initialize(self): + """ + Initialize the job. + """ + self._atomicAliases = self.configuration["atom_aliases"]["value"] + + self._xtdfile = self.configuration["xtd_file"] + + self._xtdfile.build_chemical_system(self._atomicAliases) + + self._chemicalSystem = self._xtdfile.chemicalSystem + + self._trjfile = TrjFile(self.configuration["trj_file"]["filename"]) + + # The number of steps of the analysis. + self.numberOfSteps = self._trjfile["n_frames"] + + if self._trjfile["velocities_written"]: + self._velocities = np.zeros( + (self._chemicalSystem.number_of_atoms, 3), dtype=np.float64 + ) + else: + self._velocities = None + + if self._trjfile["gradients_written"]: + self._gradients = np.zeros( + (self._chemicalSystem.number_of_atoms, 3), dtype=np.float64 + ) + else: + self._gradients = None + + # A trajectory is opened for writing. + self._trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + self._chemicalSystem, + self.numberOfSteps, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + def run_step(self, index): + """Runs a single step of the job. + + @param index: the index of the step. + @type index: int. + + @note: the argument index is the index of the loop note the index of the frame. + """ + + # The x, y and z values of the current frame. + time, cell, xyz, velocities, gradients = self._trjfile.read_step(index) + + # If the universe is periodic set its shape with the current dimensions of the unit cell. + conf = self._trajectory.chemical_system.configuration + movableAtoms = self._trjfile["mvofst"] + conf["coordinates"][movableAtoms, :] = xyz + if conf.is_periodic: + if self._trjfile["defcel"]: + conf.unit_cell = cell + if self._configuration["fold"]["value"]: + conf.fold_coordinates() + + if self._velocities is not None: + self._velocities[movableAtoms, :] = velocities + conf["velocities"] = self._velocities + + if self._gradients is not None: + self._gradients[movableAtoms, :] = gradients + conf["gradients"] = self._gradients + + self._trajectory.dump_configuration( + time, + units={ + "time": "ps", + "unit_cell": "nm", + "coordinates": "nm", + "velocities": "nm/ps", + "gradients": "uma nm/ps2", + }, + ) + + return index, None + + def combine(self, index, x): + """ + @param index: the index of the step. + @type index: int. + + @param x: + @type x: any. + """ + + pass + + def finalize(self): + """ + Finalize the job. + """ + + self._trjfile.close() + + # Close the output trajectory. + self._trajectory.close() + + super(Forcite, self).finalize() diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py b/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py index 8cc4b5fc48..0e8deb3cb0 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py @@ -1,200 +1,204 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/Gromacs.py -# @brief Implements module/class/test Gromacs -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import os - -import numpy as np - -from MDANSE.Core.Error import Error -from MDANSE.Extensions import xtc, trr -from MDANSE.Framework.Converters.Converter import Converter -from MDANSE.IO.PDBReader import PDBReader -from MDANSE.MolecularDynamics.Configuration import PeriodicRealConfiguration -from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter -from MDANSE.MolecularDynamics.UnitCell import UnitCell - - -class GromacsConverterError(Error): - pass - - -class Gromacs(Converter): - """ - Converts a Gromacs trajectory to a HDF trajectory. - """ - - label = "Gromacs" - - settings = collections.OrderedDict() - settings["pdb_file"] = ( - "InputFileConfigurator", - { - "wildcard": "PDB files (*.pdb)|*.pdb|All files|*", - "default": "INPUT_FILENAME.pdb", - "label": "Input PDB file", - }, - ) - settings["xtc_file"] = ( - "InputFileConfigurator", - { - "wildcard": "XTC files (*.xtc)|*.xtc|TRR files (*.trr)|*.trr|All files|*", - "default": "INPUT_FILENAME.xtc", - "label": "xtc or trr file", - }, - ) - settings["fold"] = ( - "BooleanConfigurator", - {"default": False, "label": "Fold coordinates into box"}, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - { - "formats": ["MDTFormat"], - "root": "pdb_file", - "label": "MDANSE trajectory (filename, format)", - }, - ) - - def initialize(self): - """ - Initialize the job. - """ - data_to_be_written = ["configuration", "time"] - - # Create XTC or TRR object depending on which kind of trajectory was loaded - if self.configuration["xtc_file"]["filename"][-4:] == ".xtc": - self._xdr_file = xtc.XTCTrajectoryFile( - self.configuration["xtc_file"]["filename"], "r" - ) - self._xtc = True - elif self.configuration["xtc_file"]["filename"][-4:] == ".trr": - self._xdr_file = trr.TRRTrajectoryFile( - self.configuration["xtc_file"]["filename"], "r" - ) - self._xtc = False - - # Extract information about whether velocities and forces are present in the TRR file - try: - self._read_velocities = self._xdr_file.has_velocities - self._read_forces = self._xdr_file.has_forces - except AttributeError: - ( - self._read_velocities, - self._read_forces, - ) = self._xdr_file._check_has_velocities_forces() - if self._read_velocities < 0 or self._read_forces < 0: - raise RuntimeError( - "Could not determine whether velocities or forces are present!" - ) - - # The TRRTrajectoryFile object returns ints for these values, so turn them into bools - self._read_velocities, self._read_forces = bool( - self._read_velocities - ), bool(self._read_forces) - - if self._read_velocities: - data_to_be_written.append("velocities") - if self._read_forces: - data_to_be_written.append("gradients") - else: - raise GromacsConverterError( - "Invalid file format: Gromacs converter can only convert XTC and TRR files, " - "but %s was provided." % self.configuration["xtc_file"]["filename"][-4:] - ) - - # The number of steps of the analysis. - self.numberOfSteps = len(self._xdr_file) - - # Create all chemical entities from the PDB file. - pdb_reader = PDBReader(self.configuration["pdb_file"]["filename"]) - chemical_system = pdb_reader.build_chemical_system() - - # A trajectory is opened for writing. - self._trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - chemical_system, - self.numberOfSteps, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - def run_step(self, index): - """Runs a single step of the job. - - @param index: the index of the step. - @type index: int. - - @note: the argument index is the index of the loop note the index of the frame. - """ - - variables = {} - - # The x, y and z values of the current frame. - if self._xtc: - coords, times, steps, box = self._xdr_file.read(1) - else: - coords, times, steps, box, __, velocities, forces = self._xdr_file.read( - 1, get_velocities=self._read_velocities, get_forces=self._read_forces - ) - - if self._read_velocities: - variables["velocities"] = velocities[0, :, :].astype(float) - if self._read_forces: - variables["gradients"] = forces[0, :, :].astype(float) - - coords = np.squeeze(coords) - - conf = PeriodicRealConfiguration( - self._trajectory.chemical_system, - coords, - UnitCell(box[0, :, :]), - **variables, - ) - - if self.configuration["fold"]["value"]: - conf.fold_coordinates() - - self._trajectory.chemical_system.configuration = conf - - # The current time. - time = times[0] - - self._trajectory.dump_configuration(time) - - return index, None - - def combine(self, index, x): - """ - @param index: the index of the step. - @type index: int. - - @param x: - @type x: any. - """ - - pass - - def finalize(self): - """ - Finalize the job. - """ - - self._xdr_file.close() - - # Close the output trajectory. - self._trajectory.close() - - super(Gromacs, self).finalize() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import os + +import numpy as np + +from MDANSE.Core.Error import Error +from MDANSE.Extensions import xtc, trr +from MDANSE.Framework.Converters.Converter import Converter +from MDANSE.IO.PDBReader import PDBReader +from MDANSE.MolecularDynamics.Configuration import PeriodicRealConfiguration +from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter +from MDANSE.MolecularDynamics.UnitCell import UnitCell + + +class GromacsConverterError(Error): + pass + + +class Gromacs(Converter): + """ + Converts a Gromacs trajectory to a HDF trajectory. + """ + + label = "Gromacs" + + settings = collections.OrderedDict() + settings["pdb_file"] = ( + "InputFileConfigurator", + { + "wildcard": "PDB files (*.pdb)|*.pdb|All files|*", + "default": "INPUT_FILENAME.pdb", + "label": "Input PDB file", + }, + ) + settings["xtc_file"] = ( + "InputFileConfigurator", + { + "wildcard": "XTC files (*.xtc)|*.xtc|TRR files (*.trr)|*.trr|All files|*", + "default": "INPUT_FILENAME.xtc", + "label": "xtc or trr file", + }, + ) + settings["fold"] = ( + "BooleanConfigurator", + {"default": False, "label": "Fold coordinates into box"}, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + { + "formats": ["MDTFormat"], + "root": "pdb_file", + "label": "MDANSE trajectory (filename, format)", + }, + ) + + def initialize(self): + """ + Initialize the job. + """ + data_to_be_written = ["configuration", "time"] + + # Create XTC or TRR object depending on which kind of trajectory was loaded + if self.configuration["xtc_file"]["filename"][-4:] == ".xtc": + self._xdr_file = xtc.XTCTrajectoryFile( + self.configuration["xtc_file"]["filename"], "r" + ) + self._xtc = True + elif self.configuration["xtc_file"]["filename"][-4:] == ".trr": + self._xdr_file = trr.TRRTrajectoryFile( + self.configuration["xtc_file"]["filename"], "r" + ) + self._xtc = False + + # Extract information about whether velocities and forces are present in the TRR file + try: + self._read_velocities = self._xdr_file.has_velocities + self._read_forces = self._xdr_file.has_forces + except AttributeError: + ( + self._read_velocities, + self._read_forces, + ) = self._xdr_file._check_has_velocities_forces() + if self._read_velocities < 0 or self._read_forces < 0: + raise RuntimeError( + "Could not determine whether velocities or forces are present!" + ) + + # The TRRTrajectoryFile object returns ints for these values, so turn them into bools + self._read_velocities, self._read_forces = bool( + self._read_velocities + ), bool(self._read_forces) + + if self._read_velocities: + data_to_be_written.append("velocities") + if self._read_forces: + data_to_be_written.append("gradients") + else: + raise GromacsConverterError( + "Invalid file format: Gromacs converter can only convert XTC and TRR files, " + "but %s was provided." % self.configuration["xtc_file"]["filename"][-4:] + ) + + # The number of steps of the analysis. + self.numberOfSteps = len(self._xdr_file) + + # Create all chemical entities from the PDB file. + pdb_reader = PDBReader(self.configuration["pdb_file"]["filename"]) + chemical_system = pdb_reader.build_chemical_system() + + # A trajectory is opened for writing. + self._trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + chemical_system, + self.numberOfSteps, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + def run_step(self, index): + """Runs a single step of the job. + + @param index: the index of the step. + @type index: int. + + @note: the argument index is the index of the loop note the index of the frame. + """ + + variables = {} + + # The x, y and z values of the current frame. + if self._xtc: + coords, times, steps, box = self._xdr_file.read(1) + else: + coords, times, steps, box, __, velocities, forces = self._xdr_file.read( + 1, get_velocities=self._read_velocities, get_forces=self._read_forces + ) + + if self._read_velocities: + variables["velocities"] = velocities[0, :, :].astype(float) + if self._read_forces: + variables["gradients"] = forces[0, :, :].astype(float) + + coords = np.squeeze(coords) + + conf = PeriodicRealConfiguration( + self._trajectory.chemical_system, + coords, + UnitCell(box[0, :, :]), + **variables, + ) + + if self.configuration["fold"]["value"]: + conf.fold_coordinates() + + self._trajectory.chemical_system.configuration = conf + + # The current time. + time = times[0] + + self._trajectory.dump_configuration(time) + + return index, None + + def combine(self, index, x): + """ + @param index: the index of the step. + @type index: int. + + @param x: + @type x: any. + """ + + pass + + def finalize(self): + """ + Finalize the job. + """ + + self._xdr_file.close() + + # Close the output trajectory. + self._trajectory.close() + + super(Gromacs, self).finalize() diff --git a/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py b/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py index 323f4bd545..c4a2d548f8 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/ASEConverter.py -# @brief Implements a general-purpose loader based on ASE +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py b/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py index 87740441ae..14052f153a 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py @@ -1,375 +1,379 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file MDANSE/Framework/Converters/LAMMPS.py -# @brief Implements module/class/test LAMMPS -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -import collections -import numpy as np - -from MDANSE.Chemistry.ChemicalEntity import Atom, AtomCluster, ChemicalSystem -from MDANSE.Core.Error import Error -from MDANSE.Framework.Converters.Converter import Converter -from MDANSE.Framework.Units import measure -from MDANSE.Mathematics.Graph import Graph -from MDANSE.MolecularDynamics.Configuration import ( - PeriodicBoxConfiguration, - PeriodicRealConfiguration, -) -from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter -from MDANSE.MolecularDynamics.UnitCell import UnitCell -from MDANSE.Framework.AtomMapping import get_element_from_mapping - - -class LAMMPSTrajectoryFileError(Error): - pass - - -class LAMMPS(Converter): - """ - Converts a LAMMPS trajectory to a HDF trajectory. - """ - - label = "LAMMPS" - - settings = collections.OrderedDict() - settings["config_file"] = ( - "ConfigFileConfigurator", - { - "label": "LAMMPS configuration file", - "wildcard": "Config files (*.config)|*.config|All files|*", - "default": "INPUT_FILENAME.config", - }, - ) - settings["trajectory_file"] = ( - "InputFileConfigurator", - { - "label": "LAMMPS trajectory file", - "wildcard": "lammps files (*.lammps)|*.lammps|All files|*", - "default": "INPUT_FILENAME.lammps", - }, - ) - settings["atom_aliases"] = ( - "AtomMappingConfigurator", - { - "default": "{}", - "label": "Atom mapping", - "dependencies": {"input_file": "config_file"}, - }, - ) - settings["time_step"] = ( - "FloatConfigurator", - {"label": "time step (fs)", "default": 1.0, "mini": 1.0e-9}, - ) - settings["n_steps"] = ( - "IntegerConfigurator", - { - "label": "number of time steps (0 for automatic detection)", - "default": 0, - "mini": 0, - }, - ) - settings["fold"] = ( - "BooleanConfigurator", - {"default": False, "label": "Fold coordinates in to box"}, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - { - "formats": ["MDTFormat"], - "root": "config_file", - "label": "MDANSE trajectory (filename, format)", - }, - ) - - def initialize(self): - """ - Initialize the job. - """ - self._atomicAliases = self.configuration["atom_aliases"]["value"] - - # The number of steps of the analysis. - self.numberOfSteps = self.configuration["n_steps"]["value"] - - self._lammpsConfig = self.configuration["config_file"] - - self.parse_first_step(self._atomicAliases) - - # Estimate number of steps if needed - if self.numberOfSteps == 0: - self.numberOfSteps = 1 - for line in self._lammps: - if line.startswith("ITEM: TIMESTEP"): - self.numberOfSteps += 1 - - # A trajectory is opened for writing. - self._trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - self._chemicalSystem, - self.numberOfSteps, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - self._nameToIndex = dict( - [(at.name, at.index) for at in self._trajectory.chemical_system.atom_list] - ) - - self._lammps.seek(0, 0) - - self._start = 0 - - def run_step(self, index): - """Runs a single step of the job. - - @param index: the index of the step. - @type index: int. - - @note: the argument index is the index of the loop note the index of the frame. - """ - - for _ in range(self._itemsPosition["TIMESTEP"][0]): - line = self._lammps.readline() - if not line: - return index, None - - time = ( - float(self._lammps.readline()) - * self.configuration["time_step"]["value"] - * measure(1.0, "fs").toval("ps") - ) - - for _ in range( - self._itemsPosition["TIMESTEP"][1], self._itemsPosition["BOX BOUNDS"][0] - ): - self._lammps.readline() - - unitCell = np.zeros((9), dtype=np.float64) - temp = [float(v) for v in self._lammps.readline().split()] - if len(temp) == 2: - xlo, xhi = temp - xy = 0.0 - elif len(temp) == 3: - xlo, xhi, xy = temp - else: - raise LAMMPSTrajectoryFileError("Bad format for A vector components") - - temp = [float(v) for v in self._lammps.readline().split()] - if len(temp) == 2: - ylo, yhi = temp - xz = 0.0 - elif len(temp) == 3: - ylo, yhi, xz = temp - else: - raise LAMMPSTrajectoryFileError("Bad format for B vector components") - - temp = [float(v) for v in self._lammps.readline().split()] - if len(temp) == 2: - zlo, zhi = temp - yz = 0.0 - elif len(temp) == 3: - zlo, zhi, yz = temp - else: - raise LAMMPSTrajectoryFileError("Bad format for C vector components") - - # The ax component. - unitCell[0] = xhi - xlo - - # The bx and by components. - unitCell[3] = xy - unitCell[4] = yhi - ylo - - # The cx, cy and cz components. - unitCell[6] = xz - unitCell[7] = yz - unitCell[8] = zhi - zlo - - unitCell = np.reshape(unitCell, (3, 3)) - - unitCell *= measure(1.0, "ang").toval("nm") - unitCell = UnitCell(unitCell) - - for _ in range( - self._itemsPosition["BOX BOUNDS"][1], self._itemsPosition["ATOMS"][0] - ): - self._lammps.readline() - - coords = np.empty( - (self._trajectory.chemical_system.number_of_atoms, 3), dtype=np.float64 - ) - - for i, _ in enumerate( - range(self._itemsPosition["ATOMS"][0], self._itemsPosition["ATOMS"][1]) - ): - temp = self._lammps.readline().split() - idx = self._nameToIndex[self._rankToName[int(temp[0]) - 1]] - coords[idx, :] = np.array( - [temp[self._x], temp[self._y], temp[self._z]], dtype=np.float64 - ) - - if self._fractionalCoordinates: - conf = PeriodicBoxConfiguration( - self._trajectory.chemical_system, coords, unitCell - ) - realConf = conf.to_real_configuration() - else: - coords *= measure(1.0, "ang").toval("nm") - realConf = PeriodicRealConfiguration( - self._trajectory.chemical_system, coords, unitCell - ) - - if self.configuration["fold"]["value"]: - # The whole configuration is folded in to the simulation box. - realConf.fold_coordinates() - - self._trajectory.chemical_system.configuration = realConf - - # A snapshot is created out of the current configuration. - self._trajectory.dump_configuration( - time, units={"time": "ps", "unit_cell": "nm", "coordinates": "nm"} - ) - - self._start += self._last - - return index, None - - def combine(self, index, x): - """ - @param index: the index of the step. - @type index: int. - - @param x: - @type x: any. - """ - - pass - - def finalize(self): - """ - Finalize the job. - """ - - self._lammps.close() - - # Close the output trajectory. - self._trajectory.close() - - super(LAMMPS, self).finalize() - - def parse_first_step(self, aliases): - self._lammps = open(self.configuration["trajectory_file"]["value"], "r") - - self._itemsPosition = collections.OrderedDict() - - comp = -1 - - while True: - line = self._lammps.readline() - comp += 1 - - if not line: - break - - if line.startswith("ITEM: TIMESTEP"): - self._itemsPosition["TIMESTEP"] = [comp + 1, comp + 2] - continue - - elif line.startswith("ITEM: BOX BOUNDS"): - self._itemsPosition["BOX BOUNDS"] = [comp + 1, comp + 4] - continue - - elif line.startswith("ITEM: ATOMS"): - keywords = line.split()[2:] - - self._id = keywords.index("id") - self._type = keywords.index("type") - - # Field name is or cd ..u if real coordinates and s if fractional ones - self._fractionalCoordinates = False - try: - self._x = keywords.index("x") - self._y = keywords.index("y") - self._z = keywords.index("z") - except ValueError: - try: - self._x = keywords.index("xu") - self._y = keywords.index("yu") - self._z = keywords.index("zu") - except ValueError: - try: - self._x = keywords.index("xs") - self._y = keywords.index("ys") - self._z = keywords.index("zs") - self._fractionalCoordinates = True - except ValueError: - raise LAMMPSTrajectoryFileError( - "No coordinates could be found in the trajectory" - ) - - self._rankToName = {} - - g = Graph() - self._itemsPosition["ATOMS"] = [comp + 1, comp + self._nAtoms + 1] - for i in range(self._nAtoms): - temp = self._lammps.readline().split() - idx = int(temp[self._id]) - 1 - ty = int(temp[self._type]) - 1 - label = str(self._lammpsConfig["elements"][ty][0]) - mass = str(self._lammpsConfig["elements"][ty][1]) - name = "{:s}_{:d}".format( - str(self._lammpsConfig["elements"][ty][0]), idx - ) - self._rankToName[int(temp[0]) - 1] = name - g.add_node(idx, label=label, mass=mass, atomName=name) - - if self._lammpsConfig["n_bonds"] is not None: - for idx1, idx2 in self._lammpsConfig["bonds"]: - g.add_link(idx1, idx2) - - self._chemicalSystem = ChemicalSystem() - - for cluster in g.build_connected_components(): - if len(cluster) == 1: - node = cluster.pop() - try: - element = get_element_from_mapping( - aliases, node.label, mass=node.mass - ) - obj = Atom(symbol=element, name=node.atomName) - except TypeError: - print("EXCEPTION in LAMMPS loader") - print(f"node.element = {node.element}") - print(f"node.atomName = {node.atomName}") - print(f"rankToName = {self._rankToName}") - obj.index = node.name - else: - atList = [] - for atom in cluster: - element = get_element_from_mapping( - aliases, atom.label, mass=atom.mass - ) - at = Atom(symbol=element, name=atom.atomName) - atList.append(at) - c = collections.Counter([at.label for at in cluster]) - name = "".join( - ["{:s}{:d}".format(k, v) for k, v in sorted(c.items())] - ) - obj = AtomCluster(name, atList) - - self._chemicalSystem.add_chemical_entity(obj) - self._last = comp + self._nAtoms + 1 - - break - - elif line.startswith("ITEM: NUMBER OF ATOMS"): - self._nAtoms = int(self._lammps.readline()) - comp += 1 - continue +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +import collections +import numpy as np + +from MDANSE.Chemistry.ChemicalEntity import Atom, AtomCluster, ChemicalSystem +from MDANSE.Core.Error import Error +from MDANSE.Framework.Converters.Converter import Converter +from MDANSE.Framework.Units import measure +from MDANSE.Mathematics.Graph import Graph +from MDANSE.MolecularDynamics.Configuration import ( + PeriodicBoxConfiguration, + PeriodicRealConfiguration, +) +from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter +from MDANSE.MolecularDynamics.UnitCell import UnitCell +from MDANSE.Framework.AtomMapping import get_element_from_mapping + + +class LAMMPSTrajectoryFileError(Error): + pass + + +class LAMMPS(Converter): + """ + Converts a LAMMPS trajectory to a HDF trajectory. + """ + + label = "LAMMPS" + + settings = collections.OrderedDict() + settings["config_file"] = ( + "ConfigFileConfigurator", + { + "label": "LAMMPS configuration file", + "wildcard": "Config files (*.config)|*.config|All files|*", + "default": "INPUT_FILENAME.config", + }, + ) + settings["trajectory_file"] = ( + "InputFileConfigurator", + { + "label": "LAMMPS trajectory file", + "wildcard": "lammps files (*.lammps)|*.lammps|All files|*", + "default": "INPUT_FILENAME.lammps", + }, + ) + settings["atom_aliases"] = ( + "AtomMappingConfigurator", + { + "default": "{}", + "label": "Atom mapping", + "dependencies": {"input_file": "config_file"}, + }, + ) + settings["time_step"] = ( + "FloatConfigurator", + {"label": "time step (fs)", "default": 1.0, "mini": 1.0e-9}, + ) + settings["n_steps"] = ( + "IntegerConfigurator", + { + "label": "number of time steps (0 for automatic detection)", + "default": 0, + "mini": 0, + }, + ) + settings["fold"] = ( + "BooleanConfigurator", + {"default": False, "label": "Fold coordinates in to box"}, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + { + "formats": ["MDTFormat"], + "root": "config_file", + "label": "MDANSE trajectory (filename, format)", + }, + ) + + def initialize(self): + """ + Initialize the job. + """ + self._atomicAliases = self.configuration["atom_aliases"]["value"] + + # The number of steps of the analysis. + self.numberOfSteps = self.configuration["n_steps"]["value"] + + self._lammpsConfig = self.configuration["config_file"] + + self.parse_first_step(self._atomicAliases) + + # Estimate number of steps if needed + if self.numberOfSteps == 0: + self.numberOfSteps = 1 + for line in self._lammps: + if line.startswith("ITEM: TIMESTEP"): + self.numberOfSteps += 1 + + # A trajectory is opened for writing. + self._trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + self._chemicalSystem, + self.numberOfSteps, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + self._nameToIndex = dict( + [(at.name, at.index) for at in self._trajectory.chemical_system.atom_list] + ) + + self._lammps.seek(0, 0) + + self._start = 0 + + def run_step(self, index): + """Runs a single step of the job. + + @param index: the index of the step. + @type index: int. + + @note: the argument index is the index of the loop note the index of the frame. + """ + + for _ in range(self._itemsPosition["TIMESTEP"][0]): + line = self._lammps.readline() + if not line: + return index, None + + time = ( + float(self._lammps.readline()) + * self.configuration["time_step"]["value"] + * measure(1.0, "fs").toval("ps") + ) + + for _ in range( + self._itemsPosition["TIMESTEP"][1], self._itemsPosition["BOX BOUNDS"][0] + ): + self._lammps.readline() + + unitCell = np.zeros((9), dtype=np.float64) + temp = [float(v) for v in self._lammps.readline().split()] + if len(temp) == 2: + xlo, xhi = temp + xy = 0.0 + elif len(temp) == 3: + xlo, xhi, xy = temp + else: + raise LAMMPSTrajectoryFileError("Bad format for A vector components") + + temp = [float(v) for v in self._lammps.readline().split()] + if len(temp) == 2: + ylo, yhi = temp + xz = 0.0 + elif len(temp) == 3: + ylo, yhi, xz = temp + else: + raise LAMMPSTrajectoryFileError("Bad format for B vector components") + + temp = [float(v) for v in self._lammps.readline().split()] + if len(temp) == 2: + zlo, zhi = temp + yz = 0.0 + elif len(temp) == 3: + zlo, zhi, yz = temp + else: + raise LAMMPSTrajectoryFileError("Bad format for C vector components") + + # The ax component. + unitCell[0] = xhi - xlo + + # The bx and by components. + unitCell[3] = xy + unitCell[4] = yhi - ylo + + # The cx, cy and cz components. + unitCell[6] = xz + unitCell[7] = yz + unitCell[8] = zhi - zlo + + unitCell = np.reshape(unitCell, (3, 3)) + + unitCell *= measure(1.0, "ang").toval("nm") + unitCell = UnitCell(unitCell) + + for _ in range( + self._itemsPosition["BOX BOUNDS"][1], self._itemsPosition["ATOMS"][0] + ): + self._lammps.readline() + + coords = np.empty( + (self._trajectory.chemical_system.number_of_atoms, 3), dtype=np.float64 + ) + + for i, _ in enumerate( + range(self._itemsPosition["ATOMS"][0], self._itemsPosition["ATOMS"][1]) + ): + temp = self._lammps.readline().split() + idx = self._nameToIndex[self._rankToName[int(temp[0]) - 1]] + coords[idx, :] = np.array( + [temp[self._x], temp[self._y], temp[self._z]], dtype=np.float64 + ) + + if self._fractionalCoordinates: + conf = PeriodicBoxConfiguration( + self._trajectory.chemical_system, coords, unitCell + ) + realConf = conf.to_real_configuration() + else: + coords *= measure(1.0, "ang").toval("nm") + realConf = PeriodicRealConfiguration( + self._trajectory.chemical_system, coords, unitCell + ) + + if self.configuration["fold"]["value"]: + # The whole configuration is folded in to the simulation box. + realConf.fold_coordinates() + + self._trajectory.chemical_system.configuration = realConf + + # A snapshot is created out of the current configuration. + self._trajectory.dump_configuration( + time, units={"time": "ps", "unit_cell": "nm", "coordinates": "nm"} + ) + + self._start += self._last + + return index, None + + def combine(self, index, x): + """ + @param index: the index of the step. + @type index: int. + + @param x: + @type x: any. + """ + + pass + + def finalize(self): + """ + Finalize the job. + """ + + self._lammps.close() + + # Close the output trajectory. + self._trajectory.close() + + super(LAMMPS, self).finalize() + + def parse_first_step(self, aliases): + self._lammps = open(self.configuration["trajectory_file"]["value"], "r") + + self._itemsPosition = collections.OrderedDict() + + comp = -1 + + while True: + line = self._lammps.readline() + comp += 1 + + if not line: + break + + if line.startswith("ITEM: TIMESTEP"): + self._itemsPosition["TIMESTEP"] = [comp + 1, comp + 2] + continue + + elif line.startswith("ITEM: BOX BOUNDS"): + self._itemsPosition["BOX BOUNDS"] = [comp + 1, comp + 4] + continue + + elif line.startswith("ITEM: ATOMS"): + keywords = line.split()[2:] + + self._id = keywords.index("id") + self._type = keywords.index("type") + + # Field name is or cd ..u if real coordinates and s if fractional ones + self._fractionalCoordinates = False + try: + self._x = keywords.index("x") + self._y = keywords.index("y") + self._z = keywords.index("z") + except ValueError: + try: + self._x = keywords.index("xu") + self._y = keywords.index("yu") + self._z = keywords.index("zu") + except ValueError: + try: + self._x = keywords.index("xs") + self._y = keywords.index("ys") + self._z = keywords.index("zs") + self._fractionalCoordinates = True + except ValueError: + raise LAMMPSTrajectoryFileError( + "No coordinates could be found in the trajectory" + ) + + self._rankToName = {} + + g = Graph() + self._itemsPosition["ATOMS"] = [comp + 1, comp + self._nAtoms + 1] + for i in range(self._nAtoms): + temp = self._lammps.readline().split() + idx = int(temp[self._id]) - 1 + ty = int(temp[self._type]) - 1 + label = str(self._lammpsConfig["elements"][ty][0]) + mass = str(self._lammpsConfig["elements"][ty][1]) + name = "{:s}_{:d}".format( + str(self._lammpsConfig["elements"][ty][0]), idx + ) + self._rankToName[int(temp[0]) - 1] = name + g.add_node(idx, label=label, mass=mass, atomName=name) + + if self._lammpsConfig["n_bonds"] is not None: + for idx1, idx2 in self._lammpsConfig["bonds"]: + g.add_link(idx1, idx2) + + self._chemicalSystem = ChemicalSystem() + + for cluster in g.build_connected_components(): + if len(cluster) == 1: + node = cluster.pop() + try: + element = get_element_from_mapping( + aliases, node.label, mass=node.mass + ) + obj = Atom(symbol=element, name=node.atomName) + except TypeError: + print("EXCEPTION in LAMMPS loader") + print(f"node.element = {node.element}") + print(f"node.atomName = {node.atomName}") + print(f"rankToName = {self._rankToName}") + obj.index = node.name + else: + atList = [] + for atom in cluster: + element = get_element_from_mapping( + aliases, atom.label, mass=atom.mass + ) + at = Atom(symbol=element, name=atom.atomName) + atList.append(at) + c = collections.Counter([at.label for at in cluster]) + name = "".join( + ["{:s}{:d}".format(k, v) for k, v in sorted(c.items())] + ) + obj = AtomCluster(name, atList) + + self._chemicalSystem.add_chemical_entity(obj) + self._last = comp + self._nAtoms + 1 + + break + + elif line.startswith("ITEM: NUMBER OF ATOMS"): + self._nAtoms = int(self._lammps.readline()) + comp += 1 + continue diff --git a/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py b/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py index 104e006b93..08747df246 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/NAMD.py -# @brief Implements module/class/test NAMD +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Converters.Converter import Converter from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/VASP.py b/MDANSE/Src/MDANSE/Framework/Converters/VASP.py index dbf4d696a1..83739771ce 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/VASP.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/VASP.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/VASP.py -# @brief Implements module/class/test VASP +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py b/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py index b25348d96d..606d88564d 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/XPLOR.py -# @brief Implements module/class/test XPLOR +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/__init__.py b/MDANSE/Src/MDANSE/Framework/Converters/__init__.py index 01e8aa3735..53b9fc0491 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Converters/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py index 57becc4e68..124aad0e97 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE/Framework/Formats/HDFFormat.py -# @brief Implements module/class/test HDFFormat +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import h5py from MDANSE.Framework.Formats.IFormat import IFormat diff --git a/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py index eed2bfb975..ac9ca93766 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Formats/IFormat.py -# @brief Implements module/class/test IFormat +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/Framework/Formats/MDAFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/MDAFormat.py index 6fb7a418b0..a91931fa7b 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/MDAFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/MDAFormat.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from MDANSE.Framework.Formats.IFormat import IFormat from typing import TYPE_CHECKING diff --git a/MDANSE/Src/MDANSE/Framework/Formats/MDTFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/MDTFormat.py index eb6a6e2de6..02a8409743 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/MDTFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/MDTFormat.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from MDANSE.Framework.Formats.IFormat import IFormat from MDANSE.Framework.OutputVariables import IOutputVariable from .HDFFormat import HDFFormat diff --git a/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py index 08faf0b09e..c3cceb064b 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Formats/SVGFormat.py -# @brief Implements module/class/test SVGFormat +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import re diff --git a/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py index d1d66c287c..bb0de2b437 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Formats/TextFormat.py -# @brief Implements module/class/test TextFormat +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import io diff --git a/MDANSE/Src/MDANSE/Framework/Formats/__init__.py b/MDANSE/Src/MDANSE/Framework/Formats/__init__.py index 34803363c1..3d42b2985b 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Formats/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py index a4ff6926da..0f5a2de34c 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Handlers/ColorizingStreamHandler.py -# @brief Implements module/class/test ColorizingStreamHandler +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import ctypes import logging diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py index bc06dc26b8..56bce6ada6 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Handlers/IHandler.py -# @brief Implements module/class/test IHandler +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py index 729347144d..754e864b2c 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Handlers/LogfileHandler.py -# @brief Implements module/class/test LogfileHandler +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import logging.handlers diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py b/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py index de6888685a..8759790dfa 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Handlers/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py b/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py index 2d25cac544..f2c2990ee6 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/EmptyData.py -# @brief Implements module/class/test EmptyData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.IInputData import IInputData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py index ca30d4de42..b5d5173763 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/HDFTrajectoryInputData.py -# @brief Implements module/class/test HDFTrajectoryInputData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.IInputData import InputDataError diff --git a/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py index 2291abd984..9cfe02d1eb 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/IInputData.py -# @brief Implements module/class/test IInputData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py b/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py index 796439aed1..203b8c03e9 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/InputFileData.py -# @brief Implements module/class/test InputFileData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc import os diff --git a/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py index 385f312a52..b0456580ae 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/MVITraceInputData.py -# @brief Implements module/class/test MVITraceInputData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.InputFileData import InputFileData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py index d83a6fbb52..2d23961bc5 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/HDFTrajectoryInputData.py -# @brief Implements module/class/test HDFTrajectoryInputData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.IInputData import InputDataError from MDANSE.Framework.InputData.InputFileData import InputFileData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py index f69bc87c98..89298fd301 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/PeriodicTableInputData.py -# @brief Implements module/class/test PeriodicTableInputData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.IInputData import IInputData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/__init__.py b/MDANSE/Src/MDANSE/Framework/InputData/__init__.py index bef7390fea..bd0c2c8165 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py index f678a347f3..f6083da55e 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py @@ -1,42 +1,46 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/InstrumentResolutions/GaussianResolution.py -# @brief Implements module/class/test GaussianResolution -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( - IInstrumentResolution, -) - - -class Gaussian(IInstrumentResolution): - """Defines an instrument resolution with a gaussian response""" - - settings = collections.OrderedDict() - settings["mu"] = ("FloatConfigurator", {"default": 0.0}) - settings["sigma"] = ("FloatConfigurator", {"default": 1.0}) - - def set_kernel(self, omegas, dt): - mu = self._configuration["mu"]["value"] - sigma = self._configuration["sigma"]["value"] - - self._omegaWindow = (np.sqrt(2.0 * np.pi) / sigma) * np.exp( - -0.5 * ((omegas - mu) / sigma) ** 2 - ) - self._timeWindow = np.fft.fftshift( - np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt - ) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( + IInstrumentResolution, +) + + +class Gaussian(IInstrumentResolution): + """Defines an instrument resolution with a gaussian response""" + + settings = collections.OrderedDict() + settings["mu"] = ("FloatConfigurator", {"default": 0.0}) + settings["sigma"] = ("FloatConfigurator", {"default": 1.0}) + + def set_kernel(self, omegas, dt): + mu = self._configuration["mu"]["value"] + sigma = self._configuration["sigma"]["value"] + + self._omegaWindow = (np.sqrt(2.0 * np.pi) / sigma) * np.exp( + -0.5 * ((omegas - mu) / sigma) ** 2 + ) + self._timeWindow = np.fft.fftshift( + np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt + ) diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py index 58e096a5ea..76f053decf 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py @@ -1,52 +1,56 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/InstrumentResolutions/IInstrumentResolution.py -# @brief Implements module/class/test IInstrumentResolution -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import abc - -from MDANSE.Core.Error import Error -from MDANSE.Framework.Configurable import Configurable - -from MDANSE.Core.SubclassFactory import SubclassFactory - - -class InstrumentResolutionError(Error): - pass - - -class IInstrumentResolution(Configurable, metaclass=SubclassFactory): - def __init__(self): - Configurable.__init__(self) - - self._omegaWindow = None - - self._timeWindow = None - - @abc.abstractmethod - def set_kernel(self, omegas, dt): - pass - - @property - def omegaWindow(self): - if self._omegaWindow is None: - raise InstrumentResolutionError("Undefined omega window") - - return self._omegaWindow - - @property - def timeWindow(self): - if self._timeWindow is None: - raise InstrumentResolutionError("Undefined time window") - - return self._timeWindow +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import abc + +from MDANSE.Core.Error import Error +from MDANSE.Framework.Configurable import Configurable + +from MDANSE.Core.SubclassFactory import SubclassFactory + + +class InstrumentResolutionError(Error): + pass + + +class IInstrumentResolution(Configurable, metaclass=SubclassFactory): + def __init__(self): + Configurable.__init__(self) + + self._omegaWindow = None + + self._timeWindow = None + + @abc.abstractmethod + def set_kernel(self, omegas, dt): + pass + + @property + def omegaWindow(self): + if self._omegaWindow is None: + raise InstrumentResolutionError("Undefined omega window") + + return self._omegaWindow + + @property + def timeWindow(self): + if self._timeWindow is None: + raise InstrumentResolutionError("Undefined time window") + + return self._timeWindow diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py index 636e5a5588..da6cd2272e 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py @@ -1,36 +1,40 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/InstrumentResolutions/IdealResolution.py -# @brief Implements module/class/test IdealResolution -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( - IInstrumentResolution, -) - - -class Ideal(IInstrumentResolution): - """Defines an ideal instrument resolution with a Dirac response""" - - settings = collections.OrderedDict() - - def set_kernel(self, omegas, dt): - nOmegas = len(omegas) - self._omegaWindow = np.zeros(nOmegas, dtype=np.float64) - self._omegaWindow[int(nOmegas / 2)] = 1.0 - - self._timeWindow = np.ones(nOmegas, dtype=np.float64) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( + IInstrumentResolution, +) + + +class Ideal(IInstrumentResolution): + """Defines an ideal instrument resolution with a Dirac response""" + + settings = collections.OrderedDict() + + def set_kernel(self, omegas, dt): + nOmegas = len(omegas) + self._omegaWindow = np.zeros(nOmegas, dtype=np.float64) + self._omegaWindow[int(nOmegas / 2)] = 1.0 + + self._timeWindow = np.ones(nOmegas, dtype=np.float64) diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py index 8c11638c90..029a7ad14b 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py @@ -1,42 +1,46 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/InstrumentResolutions/LorentzianResolution.py -# @brief Implements module/class/test LorentzianResolution -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( - IInstrumentResolution, -) - - -class Lorentzian(IInstrumentResolution): - """ - Defines an instrument resolution with a lorentzian response - """ - - settings = collections.OrderedDict() - settings["mu"] = ("FloatConfigurator", {"default": 0.0}) - settings["sigma"] = ("FloatConfigurator", {"default": 1.0}) - - def set_kernel(self, omegas, dt): - mu = self._configuration["mu"]["value"] - sigma = self._configuration["sigma"]["value"] - - self._omegaWindow = (2.0 * sigma) / ((omegas - mu) ** 2 + sigma**2) - self._timeWindow = np.fft.fftshift( - np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt - ) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( + IInstrumentResolution, +) + + +class Lorentzian(IInstrumentResolution): + """ + Defines an instrument resolution with a lorentzian response + """ + + settings = collections.OrderedDict() + settings["mu"] = ("FloatConfigurator", {"default": 0.0}) + settings["sigma"] = ("FloatConfigurator", {"default": 1.0}) + + def set_kernel(self, omegas, dt): + mu = self._configuration["mu"]["value"] + sigma = self._configuration["sigma"]["value"] + + self._omegaWindow = (2.0 * sigma) / ((omegas - mu) ** 2 + sigma**2) + self._timeWindow = np.fft.fftshift( + np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt + ) diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py index 1a3b2d069e..1b72eab7d9 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py @@ -1,52 +1,56 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/InstrumentResolutions/PseudoVoigtResolution.py -# @brief Implements module/class/test PseudoVoigtResolution -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( - IInstrumentResolution, -) - - -class PseudoVoigt(IInstrumentResolution): - """Defines an instrument resolution with a pseudo-voigt response""" - - settings = collections.OrderedDict() - settings["eta"] = ("FloatConfigurator", {"mini": 0.0, "maxi": 1.0, "default": 0.5}) - settings["mu_lorentzian"] = ("FloatConfigurator", {"default": 0.0}) - settings["sigma_lorentzian"] = ("FloatConfigurator", {"default": 1.0}) - settings["mu_gaussian"] = ("FloatConfigurator", {"default": 0.0}) - settings["sigma_gaussian"] = ("FloatConfigurator", {"default": 1.0}) - - def set_kernel(self, omegas, dt): - eta = self._configuration["eta"]["value"] - muL = self._configuration["mu_lorentzian"]["value"] - sigmaL = self._configuration["sigma_lorentzian"]["value"] - muG = self._configuration["mu_gaussian"]["value"] - sigmaG = self._configuration["sigma_gaussian"]["value"] - - gaussian = (np.sqrt(2.0 * np.pi) / sigmaG) * np.exp( - -0.5 * ((omegas - muG) / sigmaG) ** 2 - ) - - lorentzian = (2.0 * sigmaL) / ((omegas - muL) ** 2 + sigmaL**2) - - self._omegaWindow = eta * lorentzian + (1.0 - eta) * gaussian - self._timeWindow = np.fft.fftshift( - np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt - ) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( + IInstrumentResolution, +) + + +class PseudoVoigt(IInstrumentResolution): + """Defines an instrument resolution with a pseudo-voigt response""" + + settings = collections.OrderedDict() + settings["eta"] = ("FloatConfigurator", {"mini": 0.0, "maxi": 1.0, "default": 0.5}) + settings["mu_lorentzian"] = ("FloatConfigurator", {"default": 0.0}) + settings["sigma_lorentzian"] = ("FloatConfigurator", {"default": 1.0}) + settings["mu_gaussian"] = ("FloatConfigurator", {"default": 0.0}) + settings["sigma_gaussian"] = ("FloatConfigurator", {"default": 1.0}) + + def set_kernel(self, omegas, dt): + eta = self._configuration["eta"]["value"] + muL = self._configuration["mu_lorentzian"]["value"] + sigmaL = self._configuration["sigma_lorentzian"]["value"] + muG = self._configuration["mu_gaussian"]["value"] + sigmaG = self._configuration["sigma_gaussian"]["value"] + + gaussian = (np.sqrt(2.0 * np.pi) / sigmaG) * np.exp( + -0.5 * ((omegas - muG) / sigmaG) ** 2 + ) + + lorentzian = (2.0 * sigmaL) / ((omegas - muL) ** 2 + sigmaL**2) + + self._omegaWindow = eta * lorentzian + (1.0 - eta) * gaussian + self._timeWindow = np.fft.fftshift( + np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt + ) diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py index adfe834ce1..af9266c9bc 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py @@ -1,45 +1,49 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/InstrumentResolutions/SquareResolution.py -# @brief Implements module/class/test SquareResolution -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( - IInstrumentResolution, -) - - -class Square(IInstrumentResolution): - """Defines an instrument resolution with a square response""" - - settings = collections.OrderedDict() - settings["mu"] = ("FloatConfigurator", {"default": 0.0}) - settings["sigma"] = ("FloatConfigurator", {"default": 1.0}) - - def set_kernel(self, omegas, dt): - mu = self._configuration["mu"]["value"] - sigma = self._configuration["sigma"]["value"] - - self._omegaWindow = ( - 2.0 - * np.pi - * np.where((np.abs(omegas - mu) - sigma) > 0, 0.0, 1.0 / (2.0 * sigma)) - ) - - self._timeWindow = np.fft.fftshift( - np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt - ) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( + IInstrumentResolution, +) + + +class Square(IInstrumentResolution): + """Defines an instrument resolution with a square response""" + + settings = collections.OrderedDict() + settings["mu"] = ("FloatConfigurator", {"default": 0.0}) + settings["sigma"] = ("FloatConfigurator", {"default": 1.0}) + + def set_kernel(self, omegas, dt): + mu = self._configuration["mu"]["value"] + sigma = self._configuration["sigma"]["value"] + + self._omegaWindow = ( + 2.0 + * np.pi + * np.where((np.abs(omegas - mu) - sigma) > 0, 0.0, 1.0 / (2.0 * sigma)) + ) + + self._timeWindow = np.fft.fftshift( + np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt + ) diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py index 9ba2c3ee9f..ffbe2fd9fc 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py @@ -1,43 +1,47 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/InstrumentResolutions/TriangularResolution.py -# @brief Implements module/class/test TriangularResolution -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( - IInstrumentResolution, -) - - -class Triangular(IInstrumentResolution): - """Defines an instrument resolution with a triangular response""" - - settings = collections.OrderedDict() - settings["mu"] = ("FloatConfigurator", {"default": 0.0}) - settings["sigma"] = ("FloatConfigurator", {"default": 1.0}) - - def set_kernel(self, omegas, dt): - mu = self._configuration["mu"]["value"] - sigma = self._configuration["sigma"]["value"] - - val = np.abs(omegas - mu) - sigma - - self._omegaWindow = 2.0 * np.pi * np.where(val >= 0, 0.0, -val / sigma**2) - - self._timeWindow = np.fft.fftshift( - np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt - ) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( + IInstrumentResolution, +) + + +class Triangular(IInstrumentResolution): + """Defines an instrument resolution with a triangular response""" + + settings = collections.OrderedDict() + settings["mu"] = ("FloatConfigurator", {"default": 0.0}) + settings["sigma"] = ("FloatConfigurator", {"default": 1.0}) + + def set_kernel(self, omegas, dt): + mu = self._configuration["mu"]["value"] + sigma = self._configuration["sigma"]["value"] + + val = np.abs(omegas - mu) - sigma + + self._omegaWindow = 2.0 * np.pi * np.where(val >= 0, 0.0, -val / sigma**2) + + self._timeWindow = np.fft.fftshift( + np.fft.ifft(np.fft.ifftshift(self._omegaWindow)) / dt + ) diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py index 68bcdff90d..eeb2ee0c42 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InstrumentResolutions/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py b/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py index e1c4ef8542..6581bf6714 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/AngularCorrelation.py -# @brief Implements module/class/test AngularCorrelation +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py b/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py index 90b4be40a6..fe06fb18ea 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py @@ -1,161 +1,165 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/AreaPerMolecule.py -# @brief Implements module/class/test AreaPerMolecule -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import os - -import numpy as np - - -from MDANSE.Core.Error import Error -from MDANSE.Framework.Jobs.IJob import IJob - - -class AreaPerMoleculeError(Error): - pass - - -class AreaPerMolecule(IJob): - """ - Computes the area per molecule. - - The area per molecule is computed by simply dividing the surface of one of the simulation box faces - (*ab*, *bc* or *ac*) by the number of molecules with a given name. This property should be a constant unless - the simulation performed was in the NPT ensemble. This analysis is relevant for oriented structures like lipid membranes. - """ - - label = "Area Per Molecule" - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["axis"] = ( - "MultipleChoicesConfigurator", - { - "label": "area vectors", - "choices": ["a", "b", "c"], - "nChoices": 2, - "default": ["a", "b"], - }, - ) - settings["name"] = ( - "StringConfigurator", - {"label": "molecule name", "default": "DMPC"}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the analysis (open trajectory, create output variables ...) - """ - - # This will define the number of steps of the analysis. MUST be defined for all analysis. - self.numberOfSteps = self.configuration["frames"]["number"] - - # Extract the indexes corresponding to the axis selection (a=0,b=1,c=2). - self._axisIndexes = self.configuration["axis"]["indexes"] - - # The number of molecules that match the input name. Must be > 0. - self._nMolecules = len( - [ - ce - for ce in self.configuration["trajectory"][ - "instance" - ].chemical_system.chemical_entities - if ce.name == self.configuration["name"]["value"] - ] - ) - if self._nMolecules == 0: - raise AreaPerMoleculeError( - "No molecule matches %r name." % self.configuration["name"]["value"] - ) - - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["time"], - units="ps", - ) - - self._outputData.add( - "area_per_molecule", - "LineOutputVariable", - (self.configuration["frames"]["number"],), - axis="time", - units="1/nm2", - ) - - def run_step(self, index): - """ - Run a single step of the analysis - - :Parameters: - #. index (int): the index of the step. - :Returns: - #. index (int): the index of the step. - #. area per molecule (float): the calculated area per molecule for this step - """ - - # Get the frame index - frame_index = self.configuration["frames"]["value"][index] - - configuration = self.configuration["trajectory"]["instance"].configuration( - frame_index - ) - - if not configuration.is_periodic: - raise AreaPerMoleculeError("The configuration must be periodic") - - # Compute the area and then the area per molecule - unit_cell = configuration.unit_cell - normalVect = np.cross( - unit_cell[self._axisIndexes[0]], unit_cell[self._axisIndexes[1]] - ) - apm = np.sqrt(np.sum(normalVect**2)) / self._nMolecules - - return index, apm - - def combine(self, index, x): - """ - Update the output each time a step is performed - """ - - self._outputData["area_per_molecule"][index] = x - - def finalize(self): - """ - Finalize the analysis (close trajectory, write output data ...) - """ - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import os + +import numpy as np + + +from MDANSE.Core.Error import Error +from MDANSE.Framework.Jobs.IJob import IJob + + +class AreaPerMoleculeError(Error): + pass + + +class AreaPerMolecule(IJob): + """ + Computes the area per molecule. + + The area per molecule is computed by simply dividing the surface of one of the simulation box faces + (*ab*, *bc* or *ac*) by the number of molecules with a given name. This property should be a constant unless + the simulation performed was in the NPT ensemble. This analysis is relevant for oriented structures like lipid membranes. + """ + + label = "Area Per Molecule" + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["axis"] = ( + "MultipleChoicesConfigurator", + { + "label": "area vectors", + "choices": ["a", "b", "c"], + "nChoices": 2, + "default": ["a", "b"], + }, + ) + settings["name"] = ( + "StringConfigurator", + {"label": "molecule name", "default": "DMPC"}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the analysis (open trajectory, create output variables ...) + """ + + # This will define the number of steps of the analysis. MUST be defined for all analysis. + self.numberOfSteps = self.configuration["frames"]["number"] + + # Extract the indexes corresponding to the axis selection (a=0,b=1,c=2). + self._axisIndexes = self.configuration["axis"]["indexes"] + + # The number of molecules that match the input name. Must be > 0. + self._nMolecules = len( + [ + ce + for ce in self.configuration["trajectory"][ + "instance" + ].chemical_system.chemical_entities + if ce.name == self.configuration["name"]["value"] + ] + ) + if self._nMolecules == 0: + raise AreaPerMoleculeError( + "No molecule matches %r name." % self.configuration["name"]["value"] + ) + + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["time"], + units="ps", + ) + + self._outputData.add( + "area_per_molecule", + "LineOutputVariable", + (self.configuration["frames"]["number"],), + axis="time", + units="1/nm2", + ) + + def run_step(self, index): + """ + Run a single step of the analysis + + :Parameters: + #. index (int): the index of the step. + :Returns: + #. index (int): the index of the step. + #. area per molecule (float): the calculated area per molecule for this step + """ + + # Get the frame index + frame_index = self.configuration["frames"]["value"][index] + + configuration = self.configuration["trajectory"]["instance"].configuration( + frame_index + ) + + if not configuration.is_periodic: + raise AreaPerMoleculeError("The configuration must be periodic") + + # Compute the area and then the area per molecule + unit_cell = configuration.unit_cell + normalVect = np.cross( + unit_cell[self._axisIndexes[0]], unit_cell[self._axisIndexes[1]] + ) + apm = np.sqrt(np.sum(normalVect**2)) / self._nMolecules + + return index, apm + + def combine(self, index, x): + """ + Update the output each time a step is performed + """ + + self._outputData["area_per_molecule"][index] = x + + def finalize(self): + """ + Finalize the analysis (close trajectory, write output data ...) + """ + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py index 621735e3c1..8a84809346 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py @@ -1,162 +1,166 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/CenterOfMassesTrajectory.py -# @brief Implements module/class/test CenterOfMassesTrajectory -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Chemistry.ChemicalEntity import Atom, ChemicalSystem -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.MolecularDynamics.Configuration import ( - PeriodicRealConfiguration, - RealConfiguration, -) -from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter -from MDANSE.MolecularDynamics.TrajectoryUtils import group_atoms - - -class CenterOfMassesTrajectory(IJob): - """ - Creates a trajectory from the centre of masses for selected groups of atoms in a given input trajectory. - For a molecular system, the centre of mass trajectory will contain only the molecular translations, which are therefore separated from the rotations. - """ - - label = "Center Of Masses Trajectory" - - category = ( - "Analysis", - "Trajectory", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}, "default": (0, 1, 1)}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["fold"] = ( - "BooleanConfigurator", - {"default": False, "label": "Fold coordinates in to box"}, - ) - settings["grouping_level"] = ( - "GroupingLevelConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - {"format": "MDTFormat"}, - ) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["frames"]["number"] - - chemical_system = ChemicalSystem() - for i in range(len(self.configuration["atom_selection"]["indexes"])): - at = Atom(symbol="H", name="com_{:d}".format(i)) - chemical_system.add_chemical_entity(at) - - # The output trajectory is opened for writing. - self._output_trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - chemical_system, - self.numberOfSteps, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - self._grouped_atoms = group_atoms( - self.configuration["trajectory"]["instance"].chemical_system, - self.configuration["atom_selection"]["indexes"], - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. None - """ - - # get the Frame index - frameIndex = self.configuration["frames"]["value"][index] - - n_coms = self._output_trajectory.chemical_system.number_of_atoms - - conf = self.configuration["trajectory"]["instance"].configuration(frameIndex) - conf = conf.contiguous_configuration() - - com_coords = np.empty((n_coms, 3), dtype=np.float64) - for i, group in enumerate(self._grouped_atoms): - com_coords[i, :] = group.center_of_mass(conf) - - if conf.is_periodic: - com_conf = PeriodicRealConfiguration( - self._output_trajectory.chemical_system, com_coords, conf.unit_cell - ) - else: - com_conf = RealConfiguration( - self._output_trajectory.chemical_system, com_coords - ) - - if self.configuration["fold"]["value"]: - com_conf.fold_coordinates() - - self._output_trajectory.chemical_system.configuration = com_conf - - # The times corresponding to the running index. - time = self.configuration["frames"]["time"][index] - - self._output_trajectory.dump_configuration(time) - - return index, None - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - pass - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - # The input trajectory is closed. - self.configuration["trajectory"]["instance"].close() - - # The output trajectory is closed. - self._output_trajectory.close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Chemistry.ChemicalEntity import Atom, ChemicalSystem +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.MolecularDynamics.Configuration import ( + PeriodicRealConfiguration, + RealConfiguration, +) +from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter +from MDANSE.MolecularDynamics.TrajectoryUtils import group_atoms + + +class CenterOfMassesTrajectory(IJob): + """ + Creates a trajectory from the centre of masses for selected groups of atoms in a given input trajectory. + For a molecular system, the centre of mass trajectory will contain only the molecular translations, which are therefore separated from the rotations. + """ + + label = "Center Of Masses Trajectory" + + category = ( + "Analysis", + "Trajectory", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}, "default": (0, 1, 1)}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["fold"] = ( + "BooleanConfigurator", + {"default": False, "label": "Fold coordinates in to box"}, + ) + settings["grouping_level"] = ( + "GroupingLevelConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + {"format": "MDTFormat"}, + ) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["frames"]["number"] + + chemical_system = ChemicalSystem() + for i in range(len(self.configuration["atom_selection"]["indexes"])): + at = Atom(symbol="H", name="com_{:d}".format(i)) + chemical_system.add_chemical_entity(at) + + # The output trajectory is opened for writing. + self._output_trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + chemical_system, + self.numberOfSteps, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + self._grouped_atoms = group_atoms( + self.configuration["trajectory"]["instance"].chemical_system, + self.configuration["atom_selection"]["indexes"], + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. None + """ + + # get the Frame index + frameIndex = self.configuration["frames"]["value"][index] + + n_coms = self._output_trajectory.chemical_system.number_of_atoms + + conf = self.configuration["trajectory"]["instance"].configuration(frameIndex) + conf = conf.contiguous_configuration() + + com_coords = np.empty((n_coms, 3), dtype=np.float64) + for i, group in enumerate(self._grouped_atoms): + com_coords[i, :] = group.center_of_mass(conf) + + if conf.is_periodic: + com_conf = PeriodicRealConfiguration( + self._output_trajectory.chemical_system, com_coords, conf.unit_cell + ) + else: + com_conf = RealConfiguration( + self._output_trajectory.chemical_system, com_coords + ) + + if self.configuration["fold"]["value"]: + com_conf.fold_coordinates() + + self._output_trajectory.chemical_system.configuration = com_conf + + # The times corresponding to the running index. + time = self.configuration["frames"]["time"][index] + + self._output_trajectory.dump_configuration(time) + + return index, None + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + pass + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + # The input trajectory is closed. + self.configuration["trajectory"]["instance"].close() + + # The output trajectory is closed. + self._output_trajectory.close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py b/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py index 3275cb461b..7febd12ae5 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py @@ -1,202 +1,206 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/CoordinationNumber.py -# @brief Implements module/class/test CoordinationNumber -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Framework.Jobs.DistanceHistogram import DistanceHistogram - - -class CoordinationNumber(DistanceHistogram): - """ - The Coordination Number is computed from the pair distribution function for a set of atoms. - It describes the total number of neighbours, as a function of distance, from a central atom, or the centre of a group of atoms. - """ - - label = "Coordination Number" - - enabled = True - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["r_values"] = ( - "RangeConfigurator", - {"valueType": float, "includeLast": True, "mini": 0.0}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - npoints = len(self.configuration["r_values"]["mid_points"]) - - self._outputData.add( - "r", - "LineOutputVariable", - self.configuration["r_values"]["mid_points"], - units="nm", - ) - - for pair in self._elementsPairs: - invPair = pair[::-1] - self._outputData.add( - "cn_intra_%s%s" % pair, - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "cn_inter_%s%s" % pair, - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "cn_total_%s%s" % pair, - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "cn_intra_%s%s" % invPair, - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "cn_inter_%s%s" % invPair, - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "cn_total_%s%s" % invPair, - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - - nFrames = self.configuration["frames"]["number"] - - densityFactor = 4.0 * np.pi * self.configuration["r_values"]["mid_points"] - - shellSurfaces = densityFactor * self.configuration["r_values"]["mid_points"] - - shellVolumes = shellSurfaces * self.configuration["r_values"]["step"] - - self.averageDensity *= 4.0 * np.pi / nFrames - - r2 = self.configuration["r_values"]["mid_points"] ** 2 - dr = self.configuration["r_values"]["step"] - - for k in list(self._concentrations.keys()): - self._concentrations[k] /= nFrames - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for pair in self._elementsPairs: - at1, at2 = pair - ni = nAtomsPerElement[at1] - nj = nAtomsPerElement[at2] - - idi = self.selectedElements.index(at1) - idj = self.selectedElements.index(at2) - - if idi == idj: - nij = ni * (ni - 1) / 2.0 - else: - nij = ni * nj - self.hIntra[idi, idj] += self.hIntra[idj, idi] - self.hInter[idi, idj] += self.hInter[idj, idi] - - fact = nij * nFrames * shellVolumes - - self.hIntra[idi, idj, :] /= fact - self.hInter[idi, idj, :] /= fact - - cnIntra = np.add.accumulate(self.hIntra[idi, idj, :] * r2) * dr - cnInter = np.add.accumulate(self.hInter[idi, idj, :] * r2) * dr - cnTotal = cnIntra + cnInter - - cAlpha = self._concentrations[pair[0]] - cBeta = self._concentrations[pair[1]] - - invPair = pair[::-1] - - self._outputData["cn_intra_%s%s" % pair][:] = ( - self.averageDensity * cBeta * cnIntra - ) - self._outputData["cn_inter_%s%s" % pair][:] = ( - self.averageDensity * cBeta * cnInter - ) - self._outputData["cn_total_%s%s" % pair][:] = ( - self.averageDensity * cBeta * cnTotal - ) - self._outputData["cn_intra_%s%s" % invPair][:] = ( - self.averageDensity * cAlpha * cnIntra - ) - self._outputData["cn_inter_%s%s" % invPair][:] = ( - self.averageDensity * cAlpha * cnInter - ) - self._outputData["cn_total_%s%s" % invPair][:] = ( - self.averageDensity * cAlpha * cnTotal - ) - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() - - DistanceHistogram.finalize(self) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Framework.Jobs.DistanceHistogram import DistanceHistogram + + +class CoordinationNumber(DistanceHistogram): + """ + The Coordination Number is computed from the pair distribution function for a set of atoms. + It describes the total number of neighbours, as a function of distance, from a central atom, or the centre of a group of atoms. + """ + + label = "Coordination Number" + + enabled = True + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["r_values"] = ( + "RangeConfigurator", + {"valueType": float, "includeLast": True, "mini": 0.0}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + npoints = len(self.configuration["r_values"]["mid_points"]) + + self._outputData.add( + "r", + "LineOutputVariable", + self.configuration["r_values"]["mid_points"], + units="nm", + ) + + for pair in self._elementsPairs: + invPair = pair[::-1] + self._outputData.add( + "cn_intra_%s%s" % pair, + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "cn_inter_%s%s" % pair, + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "cn_total_%s%s" % pair, + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "cn_intra_%s%s" % invPair, + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "cn_inter_%s%s" % invPair, + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "cn_total_%s%s" % invPair, + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + + nFrames = self.configuration["frames"]["number"] + + densityFactor = 4.0 * np.pi * self.configuration["r_values"]["mid_points"] + + shellSurfaces = densityFactor * self.configuration["r_values"]["mid_points"] + + shellVolumes = shellSurfaces * self.configuration["r_values"]["step"] + + self.averageDensity *= 4.0 * np.pi / nFrames + + r2 = self.configuration["r_values"]["mid_points"] ** 2 + dr = self.configuration["r_values"]["step"] + + for k in list(self._concentrations.keys()): + self._concentrations[k] /= nFrames + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for pair in self._elementsPairs: + at1, at2 = pair + ni = nAtomsPerElement[at1] + nj = nAtomsPerElement[at2] + + idi = self.selectedElements.index(at1) + idj = self.selectedElements.index(at2) + + if idi == idj: + nij = ni * (ni - 1) / 2.0 + else: + nij = ni * nj + self.hIntra[idi, idj] += self.hIntra[idj, idi] + self.hInter[idi, idj] += self.hInter[idj, idi] + + fact = nij * nFrames * shellVolumes + + self.hIntra[idi, idj, :] /= fact + self.hInter[idi, idj, :] /= fact + + cnIntra = np.add.accumulate(self.hIntra[idi, idj, :] * r2) * dr + cnInter = np.add.accumulate(self.hInter[idi, idj, :] * r2) * dr + cnTotal = cnIntra + cnInter + + cAlpha = self._concentrations[pair[0]] + cBeta = self._concentrations[pair[1]] + + invPair = pair[::-1] + + self._outputData["cn_intra_%s%s" % pair][:] = ( + self.averageDensity * cBeta * cnIntra + ) + self._outputData["cn_inter_%s%s" % pair][:] = ( + self.averageDensity * cBeta * cnInter + ) + self._outputData["cn_total_%s%s" % pair][:] = ( + self.averageDensity * cBeta * cnTotal + ) + self._outputData["cn_intra_%s%s" % invPair][:] = ( + self.averageDensity * cAlpha * cnIntra + ) + self._outputData["cn_inter_%s%s" % invPair][:] = ( + self.averageDensity * cAlpha * cnInter + ) + self._outputData["cn_total_%s%s" % invPair][:] = ( + self.averageDensity * cAlpha * cnTotal + ) + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() + + DistanceHistogram.finalize(self) diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py index 2fb8ba7828..ca1daf4a2a 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py @@ -1,128 +1,132 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/CroppedTrajectory.py -# @brief Implements module/class/test CroppedTrajectory -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - - -from MDANSE.Chemistry.ChemicalEntity import AtomGroup -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.MolecularDynamics.Trajectory import sorted_atoms -from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter - - -class CroppedTrajectory(IJob): - """ - Crop a trajectory in terms of the contents of the simulation box (selected atoms or molecules) and the trajectory length. - """ - - enabled = False - - label = "Cropped Trajectory" - - category = ( - "Analysis", - "Trajectory", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - {"format": "MDTFormat"}, - ) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["frames"]["number"] - - atoms = sorted_atoms( - self.configuration["trajectory"]["instance"].chemical_system.atom_list - ) - - # The collection of atoms corresponding to the atoms selected for output. - indexes = [ - idx - for idxs in self.configuration["atom_selection"]["indexes"] - for idx in idxs - ] - self._selectedAtoms = [atoms[ind] for ind in indexes] - - # The output trajectory is opened for writing. - self._output_trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - self.configuration["trajectory"]["instance"].chemical_system, - self.numberOfSteps, - self._selectedAtoms, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. None - """ - - # get the Frame index - frame_index = self.configuration["frames"]["value"][index] - - conf = self.configuration["trajectory"]["instance"].configuration(frame_index) - - cloned_conf = conf.clone(self._output_trajectory.chemical_system) - - self._output_trajectory.chemical_system.configuration = cloned_conf - - time = self.configuration["frames"]["time"][index] - - self._output_trajectory.dump_configuration(time) - - return index, None - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - pass - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - # The input trajectory is closed. - self.configuration["trajectory"]["instance"].close() - - # The output trajectory is closed. - self._output_trajectory.close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + + +from MDANSE.Chemistry.ChemicalEntity import AtomGroup +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.MolecularDynamics.Trajectory import sorted_atoms +from MDANSE.MolecularDynamics.Trajectory import TrajectoryWriter + + +class CroppedTrajectory(IJob): + """ + Crop a trajectory in terms of the contents of the simulation box (selected atoms or molecules) and the trajectory length. + """ + + enabled = False + + label = "Cropped Trajectory" + + category = ( + "Analysis", + "Trajectory", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + {"format": "MDTFormat"}, + ) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["frames"]["number"] + + atoms = sorted_atoms( + self.configuration["trajectory"]["instance"].chemical_system.atom_list + ) + + # The collection of atoms corresponding to the atoms selected for output. + indexes = [ + idx + for idxs in self.configuration["atom_selection"]["indexes"] + for idx in idxs + ] + self._selectedAtoms = [atoms[ind] for ind in indexes] + + # The output trajectory is opened for writing. + self._output_trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + self.configuration["trajectory"]["instance"].chemical_system, + self.numberOfSteps, + self._selectedAtoms, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. None + """ + + # get the Frame index + frame_index = self.configuration["frames"]["value"][index] + + conf = self.configuration["trajectory"]["instance"].configuration(frame_index) + + cloned_conf = conf.clone(self._output_trajectory.chemical_system) + + self._output_trajectory.chemical_system.configuration = cloned_conf + + time = self.configuration["frames"]["time"][index] + + self._output_trajectory.dump_configuration(time) + + return index, None + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + pass + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + # The input trajectory is closed. + self.configuration["trajectory"]["instance"].close() + + # The output trajectory is closed. + self._output_trajectory.close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py index 24ac962a61..5b3691ed4d 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py @@ -1,595 +1,599 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/CurrentCorrelationFunction.py -# @brief Implements module/class/test CurrentCorrelationFunction -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import itertools -from math import ceil -import os -from tempfile import gettempdir, tempdir - -import numpy as np - -import h5py - - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Arithmetic import weight -from MDANSE.Mathematics.Signal import ( - correlation, - differentiate, - normalize, - get_spectrum, -) -from MDANSE.MolecularDynamics.Trajectory import read_atoms_trajectory - - -class CurrentCorrelationFunctionError(Exception): - pass - - -class CurrentCorrelationFunction(IJob): - """ - Computes the current correlation function for a set of atoms. - The transverse and longitudinal current correlation functions are typically used to study the propagation of excitations in disordered systems. - The longitudinal current is directly related to density fluctuations and the transverse current is linked to propagating 'shear modes'. - - For more information, see e.g. 'J.-P. Hansen and I. R. McDonald, Theory of Simple Liquids (3rd ed., Elsevier), chapter 7.4: Correlations - in space and time)' - """ - - enabled = False - - label = "Current Correlation Function" - - category = ( - "Analysis", - "Scattering", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["instrument_resolution"] = ( - "InstrumentResolutionConfigurator", - {"dependencies": {"trajectory": "trajectory", "frames": "frames"}}, - ) - settings["interpolation_order"] = ( - "InterpolationOrderConfigurator", - { - "label": "velocities", - "dependencies": {"trajectory": "trajectory"}, - "default": 1, - }, - ) - settings["interpolation_mode"] = ( - "SingleChoiceConfigurator", - { - "choices": [ - "one-time in-memory interpolation", - "repeated interpolation", - "one-time disk interpolation", - "automatic", - ], - "default": "automatic", - }, - ) - settings["number_of_preloaded_fames"] = ( - "IntegerConfigurator", - {"default": 50, "mini": -1, "exclude": (0,)}, - ) - settings["q_vectors"] = ( - "QVectorsConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["normalize"] = ("BooleanConfigurator", {"default": False}) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["weights"] = ( - "WeightsConfigurator", - { - "default": "b_coherent", - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - "atom_transmutation": "atom_transmutation", - }, - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["q_vectors"]["n_shells"] - - nQShells = self.configuration["q_vectors"]["n_shells"] - - self._nFrames = self.configuration["frames"]["number"] - - self._instrResolution = self.configuration["instrument_resolution"] - - self._nOmegas = self._instrResolution["n_omegas"] - - self._outputData.add( - "q", - "LineOutputVariable", - np.array(self.configuration["q_vectors"]["shells"]), - units="1/nm", - ) - - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["duration"], - units="ps", - ) - self._outputData.add( - "time_window", - "LineOutputVariable", - self._instrResolution["time_window"], - units="au", - ) - - self._outputData.add( - "omega", - "LineOutputVariable", - self._instrResolution["omega"], - units="rad/ps", - ) - self._outputData.add( - "omega_window", - "LineOutputVariable", - self._instrResolution["omega_window"], - axis="omega", - units="au", - ) - - self._elements = self.configuration["atom_selection"]["unique_names"] - self._elementsPairs = sorted( - itertools.combinations_with_replacement(self._elements, 2) - ) - - self._indexesPerElement = self.configuration["atom_selection"].get_indexes() - - for pair in self._elementsPairs: - self._outputData.add( - "j(q,t)_long_%s%s" % pair, - "SurfaceOutputVariable", - (nQShells, self._nFrames), - axis="q|time", - units="au", - ) - self._outputData.add( - "j(q,t)_trans_%s%s" % pair, - "SurfaceOutputVariable", - (nQShells, self._nFrames), - axis="q|time", - units="au", - ) - self._outputData.add( - "J(q,f)_long_%s%s" % pair, - "SurfaceOutputVariable", - (nQShells, self._nOmegas), - axis="q|omega", - units="au", - ) - self._outputData.add( - "J(q,f)_trans_%s%s" % pair, - "SurfaceOutputVariable", - (nQShells, self._nOmegas), - axis="q|omega", - units="au", - ) - - self._outputData.add( - "j(q,t)_long_total", - "SurfaceOutputVariable", - (nQShells, self._nFrames), - axis="q|time", - units="au", - ) - self._outputData.add( - "J(q,f)_long_total", - "SurfaceOutputVariable", - (nQShells, self._nOmegas), - axis="q|omega", - units="au", - ) - self._outputData.add( - "j(q,t)_trans_total", - "SurfaceOutputVariable", - (nQShells, self._nFrames), - axis="q|time", - units="au", - ) - self._outputData.add( - "J(q,f)_trans_total", - "SurfaceOutputVariable", - (nQShells, self._nOmegas), - axis="q|omega", - units="au", - ) - - traj = self.configuration["trajectory"]["instance"] - nAtoms = traj.universe.numberOfAtoms() - nFrames = self.configuration["frames"]["n_frames"] - - # Interpolate velocities of all atoms throughout the entire trajectory - self._order = self.configuration["interpolation_order"]["value"] - self._mode = self.configuration["interpolation_mode"]["index"] - self._preload = self.configuration["number_of_preloaded_fames"]["value"] - - if self._order != "no interpolation" and self._mode == 3: - from psutil import virtual_memory - - max_memory = virtual_memory().total - - if max_memory > nFrames * nAtoms * 3 * 8: - self._mode = 0 - else: - most_atoms = 0 - for idxs in list(self._indexesPerElement.values()): - if len(idxs) > most_atoms: - most_atoms = len(idxs) - - if max_memory > nFrames * most_atoms * 3 * 8: - self._mode = 1 - else: - self._mode = 2 - - if self._order != "no interpolation" and self._mode == 0: - self._velocities = np.empty((nAtoms, nFrames, 3), dtype=float) - # Loop over the selected indexes and fill only this part of the - # self._velocities array, the rest, which is useless, remaining unset. - for idx in self.configuration["atom_selection"]["flatten_indexes"]: - atomicTraj = read_atoms_trajectory( - traj, - [idx], - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - variable=self.configuration["interpolation_order"]["variable"], - ) - for axis in range(3): - self._velocities[idx, :, axis] = differentiate( - atomicTraj[:, axis], - order=self._order, - dt=self.configuration["frames"]["time_step"], - ) - - # An alternative interpolation method which saves the velocities to an HDF5-style .nc file to save on memory - elif self._order != "no interpolation" and self._mode == 2: - if not hasattr(self, "_name"): - self._name = "_".join([self.__name__, IJob.define_unique_name()]) - - with h5py.File( - os.path.join(gettempdir(), "mdanse_" + self.name + ".h5"), "w" - ) as velocities: - velocities.createDimension("particles", nAtoms + 1) - velocities.createDimension("time", nFrames) - velocities.createDimension("axis", 3) - - if self._preload < 25: - # Chunking into 10x10 grid has shown to be faster at low self._preload values - velocities.createVariable( - "velocities", - "f8", - ("particles", "time", "axis"), - chunksizes=(ceil((nAtoms + 1) / 10), ceil(nFrames / 10), 3), - ) - else: - # At high self._preload values, chunks consisting of all atoms x preload number of frames are faster - velocities.createVariable( - "velocities", - "f8", - ("particles", "time", "axis"), - chunksizes=((nAtoms + 1), self._preload, 3), - ) - - vels = np.empty((nFrames, 3)) - for idx in self.configuration["atom_selection"]["flatten_indexes"]: - atomicTraj = read_atoms_trajectory( - traj, - [idx], - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - variable=self.configuration["interpolation_order"]["variable"], - ) - for axis in range(3): - vels[:, axis] = differentiate( - atomicTraj[:, axis], - order=self._order, - dt=self.configuration["frames"]["time_step"], - ) - velocities["velocities"][idx, :, :] = vels - self._data_file = h5py.File( - os.path.join(tempdir, "mdanse_" + self.name + ".h5"), "r" - ) - self._velocities = self._data_file["velocities"] - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. rho (np.array): The exponential part of I(q,t) - """ - - shell = self.configuration["q_vectors"]["shells"][index] - - if not shell in self.configuration["q_vectors"]["value"]: - return index, None - - traj = self.configuration["trajectory"]["instance"] - - qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"] - - nQVectors = qVectors.shape[1] - - rho = {} - rho_loop = {} - rhoLong = {} - rhoTrans = {} - rhoLong_loop = {} - rhoTrans_loop = {} - for element in self._elements: - rho[element] = np.zeros((self._nFrames, 3, nQVectors), dtype=np.complex64) - rho_loop[element] = np.zeros( - (self._nFrames, 3, nQVectors), dtype=np.complex64 - ) - rhoLong_loop[element] = np.zeros( - (self._nFrames, 3, nQVectors), dtype=np.complex64 - ) - rhoTrans_loop[element] = np.zeros( - (self._nFrames, 3, nQVectors), dtype=np.complex64 - ) - - # Certain interpolation strategies are faster when looping occurs primarily over elements - if self._order != "no interpolation" and ( - self._mode == 1 or (self._mode == 2 and self._preload == -1) - ): - for element, idxs in list(self._indexesPerElement.items()): - nFrames = self.configuration["frames"]["n_frames"] - all_velocities = np.empty((len(idxs), nFrames, 3), dtype=float) - - if self._mode == 1: - # Looping over elements is the only way to make repeated interpolation feasible at all - for i, __ in enumerate(idxs): - atomicTraj = read_atoms_trajectory( - traj, - [i], - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - variable=self.configuration["interpolation_order"][ - "variable" - ], - ) - for axis in range(3): - all_velocities[i, :, axis] = differentiate( - atomicTraj[:, axis], - order=self._order, - dt=self.configuration["frames"]["time_step"], - ) - elif self._mode == 2: - # Loading the whole trajectory of atoms of 1 element into memory can be faster than above, and - # is much faster than accessing the disk repeatedly, but it takes more memory too. - all_velocities[:, :, :] = self._velocities[idxs, :, :] - - for i, frame in enumerate(self.configuration["frames"]["value"]): - coordinates = traj.configuration[frame].array[idxs, :] - velocities = np.transpose(all_velocities[:, i, :])[:, :, np.newaxis] - tmp = np.exp(1j * np.dot(coordinates, qVectors))[np.newaxis, :, :] - rho[element][i, :, :] = np.add.reduce(velocities * tmp, 1) - - Q2 = np.sum(qVectors**2, axis=0) - - qj = np.sum(rho[element] * qVectors, axis=1) - rhoLong[element] = ( - qj[:, np.newaxis, :] * qVectors[np.newaxis, :, :] - ) / Q2 - rhoTrans[element] = rho[element] - rhoLong[element] - - # No interpolation and some interpolation approaches are faster when looping occurs primarily over frames - else: - # loop over the trajectory time steps - for i, frame in enumerate(self.configuration["frames"]["value"]): - conf = traj.configuration[frame] - - if self._order == "no interpolation": - vel = traj.velocities[frame].array - elif self._mode == 0: - vel = self._velocities[:, i, :] - else: - # When accessing disk repeatedly (minimum memory usage), it is faster to load a whole frame at once - # as it requires fewer I/O. This does take more memory, but only as much as if there were no - # interpolation, since that also loads one whole frame at a time. - if i % self._preload == 0: - try: - preloaded_velocities = self._velocities[ - :, [j + i for j in range(self._preload)], : - ] - except IndexError: - preloaded_velocities = vel = self._velocities[:, i:, :] - vel = preloaded_velocities[:, i % self._preload, :] - - for element, idxs in list(self._indexesPerElement.items()): - selectedCoordinates = conf.array[idxs, :] - selectedVelocities = vel[idxs, :] - selectedVelocities = np.transpose(selectedVelocities)[ - :, :, np.newaxis - ] - tmp = np.exp(1j * np.dot(selectedCoordinates, qVectors))[ - np.newaxis, :, : - ] - rho[element][i, :, :] = np.add.reduce(selectedVelocities * tmp, 1) - - Q2 = np.sum(qVectors**2, axis=0) - - for element in self._elements: - qj = np.sum(rho[element] * qVectors, axis=1) - rhoLong[element] = ( - qj[:, np.newaxis, :] * qVectors[np.newaxis, :, :] - ) / Q2 - rhoTrans[element] = rho[element] - rhoLong[element] - - return index, (rhoLong, rhoTrans) - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - if x is None: - return - - jLong, jTrans = x - - for at1, at2 in self._elementsPairs: - corrLong = np.zeros((self._nFrames,), dtype=np.float64) - corrTrans = np.zeros((self._nFrames,), dtype=np.float64) - - for i in range(3): - corrLong += correlation( - jLong[at1][:, i, :], jLong[at2][:, i, :], axis=0, average=1 - ) - corrTrans += correlation( - jTrans[at1][:, i, :], jTrans[at2][:, i, :], axis=0, average=1 - ) - - self._outputData["j(q,t)_long_%s%s" % (at1, at2)][index, :] += corrLong - self._outputData["j(q,t)_trans_%s%s" % (at1, at2)][index, :] += corrTrans - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...) - """ - try: - self._data_file.close() - except (AttributeError, RuntimeError): - pass - - try: - os.remove(os.path.join(tempdir, "mdanse_" + self.name + ".nc")) - except (OSError, AttributeError): - # OSError catches file not existing, and AttributeError caches gettempdir() having not been called - pass - - try: - del self._velocities - except AttributeError: - pass - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for pair in self._elementsPairs: - at1, at2 = pair - ni = nAtomsPerElement[at1] - nj = nAtomsPerElement[at2] - self._outputData["j(q,t)_long_%s%s" % pair][:] /= ni * nj - self._outputData["j(q,t)_trans_%s%s" % pair][:] /= ni * nj - self._outputData["J(q,f)_long_%s%s" % pair][:] = get_spectrum( - self._outputData["j(q,t)_long_%s%s" % pair], - self.configuration["instrument_resolution"]["time_window"], - self.configuration["instrument_resolution"]["time_step"], - axis=1, - ) - self._outputData["J(q,f)_trans_%s%s" % pair][:] = get_spectrum( - self._outputData["j(q,t)_trans_%s%s" % pair], - self.configuration["instrument_resolution"]["time_window"], - self.configuration["instrument_resolution"]["time_step"], - axis=1, - ) - - if self.configuration["normalize"]["value"]: - for pair in self._elementsPairs: - self._outputData["j(q,t)_long_%s%s" % pair] = normalize( - self._outputData["j(q,t)_long_%s%s" % pair], axis=1 - ) - self._outputData["j(q,t)_trans_%s%s" % pair] = normalize( - self._outputData["j(q,t)_trans_%s%s" % pair], axis=1 - ) - - jqtLongTotal = weight( - self.configuration["weights"].get_weights(), - self._outputData, - nAtomsPerElement, - 2, - "j(q,t)_long_%s%s", - ) - self._outputData["j(q,t)_long_total"][:] = jqtLongTotal - - jqtTransTotal = weight( - self.configuration["weights"].get_weights(), - self._outputData, - nAtomsPerElement, - 2, - "j(q,t)_trans_%s%s", - ) - self._outputData["j(q,t)_trans_total"][:] = jqtTransTotal - - sqfLongTotal = weight( - self.configuration["weights"].get_weights(), - self._outputData, - nAtomsPerElement, - 2, - "J(q,f)_long_%s%s", - ) - self._outputData["J(q,f)_long_total"][:] = sqfLongTotal - - sqfTransTotal = weight( - self.configuration["weights"].get_weights(), - self._outputData, - nAtomsPerElement, - 2, - "J(q,f)_trans_%s%s", - ) - self._outputData["J(q,f)_trans_total"][:] = sqfTransTotal - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import itertools +from math import ceil +import os +from tempfile import gettempdir, tempdir + +import numpy as np + +import h5py + + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Arithmetic import weight +from MDANSE.Mathematics.Signal import ( + correlation, + differentiate, + normalize, + get_spectrum, +) +from MDANSE.MolecularDynamics.Trajectory import read_atoms_trajectory + + +class CurrentCorrelationFunctionError(Exception): + pass + + +class CurrentCorrelationFunction(IJob): + """ + Computes the current correlation function for a set of atoms. + The transverse and longitudinal current correlation functions are typically used to study the propagation of excitations in disordered systems. + The longitudinal current is directly related to density fluctuations and the transverse current is linked to propagating 'shear modes'. + + For more information, see e.g. 'J.-P. Hansen and I. R. McDonald, Theory of Simple Liquids (3rd ed., Elsevier), chapter 7.4: Correlations + in space and time)' + """ + + enabled = False + + label = "Current Correlation Function" + + category = ( + "Analysis", + "Scattering", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["instrument_resolution"] = ( + "InstrumentResolutionConfigurator", + {"dependencies": {"trajectory": "trajectory", "frames": "frames"}}, + ) + settings["interpolation_order"] = ( + "InterpolationOrderConfigurator", + { + "label": "velocities", + "dependencies": {"trajectory": "trajectory"}, + "default": 1, + }, + ) + settings["interpolation_mode"] = ( + "SingleChoiceConfigurator", + { + "choices": [ + "one-time in-memory interpolation", + "repeated interpolation", + "one-time disk interpolation", + "automatic", + ], + "default": "automatic", + }, + ) + settings["number_of_preloaded_fames"] = ( + "IntegerConfigurator", + {"default": 50, "mini": -1, "exclude": (0,)}, + ) + settings["q_vectors"] = ( + "QVectorsConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["normalize"] = ("BooleanConfigurator", {"default": False}) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["weights"] = ( + "WeightsConfigurator", + { + "default": "b_coherent", + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + "atom_transmutation": "atom_transmutation", + }, + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["q_vectors"]["n_shells"] + + nQShells = self.configuration["q_vectors"]["n_shells"] + + self._nFrames = self.configuration["frames"]["number"] + + self._instrResolution = self.configuration["instrument_resolution"] + + self._nOmegas = self._instrResolution["n_omegas"] + + self._outputData.add( + "q", + "LineOutputVariable", + np.array(self.configuration["q_vectors"]["shells"]), + units="1/nm", + ) + + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["duration"], + units="ps", + ) + self._outputData.add( + "time_window", + "LineOutputVariable", + self._instrResolution["time_window"], + units="au", + ) + + self._outputData.add( + "omega", + "LineOutputVariable", + self._instrResolution["omega"], + units="rad/ps", + ) + self._outputData.add( + "omega_window", + "LineOutputVariable", + self._instrResolution["omega_window"], + axis="omega", + units="au", + ) + + self._elements = self.configuration["atom_selection"]["unique_names"] + self._elementsPairs = sorted( + itertools.combinations_with_replacement(self._elements, 2) + ) + + self._indexesPerElement = self.configuration["atom_selection"].get_indexes() + + for pair in self._elementsPairs: + self._outputData.add( + "j(q,t)_long_%s%s" % pair, + "SurfaceOutputVariable", + (nQShells, self._nFrames), + axis="q|time", + units="au", + ) + self._outputData.add( + "j(q,t)_trans_%s%s" % pair, + "SurfaceOutputVariable", + (nQShells, self._nFrames), + axis="q|time", + units="au", + ) + self._outputData.add( + "J(q,f)_long_%s%s" % pair, + "SurfaceOutputVariable", + (nQShells, self._nOmegas), + axis="q|omega", + units="au", + ) + self._outputData.add( + "J(q,f)_trans_%s%s" % pair, + "SurfaceOutputVariable", + (nQShells, self._nOmegas), + axis="q|omega", + units="au", + ) + + self._outputData.add( + "j(q,t)_long_total", + "SurfaceOutputVariable", + (nQShells, self._nFrames), + axis="q|time", + units="au", + ) + self._outputData.add( + "J(q,f)_long_total", + "SurfaceOutputVariable", + (nQShells, self._nOmegas), + axis="q|omega", + units="au", + ) + self._outputData.add( + "j(q,t)_trans_total", + "SurfaceOutputVariable", + (nQShells, self._nFrames), + axis="q|time", + units="au", + ) + self._outputData.add( + "J(q,f)_trans_total", + "SurfaceOutputVariable", + (nQShells, self._nOmegas), + axis="q|omega", + units="au", + ) + + traj = self.configuration["trajectory"]["instance"] + nAtoms = traj.universe.numberOfAtoms() + nFrames = self.configuration["frames"]["n_frames"] + + # Interpolate velocities of all atoms throughout the entire trajectory + self._order = self.configuration["interpolation_order"]["value"] + self._mode = self.configuration["interpolation_mode"]["index"] + self._preload = self.configuration["number_of_preloaded_fames"]["value"] + + if self._order != "no interpolation" and self._mode == 3: + from psutil import virtual_memory + + max_memory = virtual_memory().total + + if max_memory > nFrames * nAtoms * 3 * 8: + self._mode = 0 + else: + most_atoms = 0 + for idxs in list(self._indexesPerElement.values()): + if len(idxs) > most_atoms: + most_atoms = len(idxs) + + if max_memory > nFrames * most_atoms * 3 * 8: + self._mode = 1 + else: + self._mode = 2 + + if self._order != "no interpolation" and self._mode == 0: + self._velocities = np.empty((nAtoms, nFrames, 3), dtype=float) + # Loop over the selected indexes and fill only this part of the + # self._velocities array, the rest, which is useless, remaining unset. + for idx in self.configuration["atom_selection"]["flatten_indexes"]: + atomicTraj = read_atoms_trajectory( + traj, + [idx], + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + variable=self.configuration["interpolation_order"]["variable"], + ) + for axis in range(3): + self._velocities[idx, :, axis] = differentiate( + atomicTraj[:, axis], + order=self._order, + dt=self.configuration["frames"]["time_step"], + ) + + # An alternative interpolation method which saves the velocities to an HDF5-style .nc file to save on memory + elif self._order != "no interpolation" and self._mode == 2: + if not hasattr(self, "_name"): + self._name = "_".join([self.__name__, IJob.define_unique_name()]) + + with h5py.File( + os.path.join(gettempdir(), "mdanse_" + self.name + ".h5"), "w" + ) as velocities: + velocities.createDimension("particles", nAtoms + 1) + velocities.createDimension("time", nFrames) + velocities.createDimension("axis", 3) + + if self._preload < 25: + # Chunking into 10x10 grid has shown to be faster at low self._preload values + velocities.createVariable( + "velocities", + "f8", + ("particles", "time", "axis"), + chunksizes=(ceil((nAtoms + 1) / 10), ceil(nFrames / 10), 3), + ) + else: + # At high self._preload values, chunks consisting of all atoms x preload number of frames are faster + velocities.createVariable( + "velocities", + "f8", + ("particles", "time", "axis"), + chunksizes=((nAtoms + 1), self._preload, 3), + ) + + vels = np.empty((nFrames, 3)) + for idx in self.configuration["atom_selection"]["flatten_indexes"]: + atomicTraj = read_atoms_trajectory( + traj, + [idx], + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + variable=self.configuration["interpolation_order"]["variable"], + ) + for axis in range(3): + vels[:, axis] = differentiate( + atomicTraj[:, axis], + order=self._order, + dt=self.configuration["frames"]["time_step"], + ) + velocities["velocities"][idx, :, :] = vels + self._data_file = h5py.File( + os.path.join(tempdir, "mdanse_" + self.name + ".h5"), "r" + ) + self._velocities = self._data_file["velocities"] + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. rho (np.array): The exponential part of I(q,t) + """ + + shell = self.configuration["q_vectors"]["shells"][index] + + if not shell in self.configuration["q_vectors"]["value"]: + return index, None + + traj = self.configuration["trajectory"]["instance"] + + qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"] + + nQVectors = qVectors.shape[1] + + rho = {} + rho_loop = {} + rhoLong = {} + rhoTrans = {} + rhoLong_loop = {} + rhoTrans_loop = {} + for element in self._elements: + rho[element] = np.zeros((self._nFrames, 3, nQVectors), dtype=np.complex64) + rho_loop[element] = np.zeros( + (self._nFrames, 3, nQVectors), dtype=np.complex64 + ) + rhoLong_loop[element] = np.zeros( + (self._nFrames, 3, nQVectors), dtype=np.complex64 + ) + rhoTrans_loop[element] = np.zeros( + (self._nFrames, 3, nQVectors), dtype=np.complex64 + ) + + # Certain interpolation strategies are faster when looping occurs primarily over elements + if self._order != "no interpolation" and ( + self._mode == 1 or (self._mode == 2 and self._preload == -1) + ): + for element, idxs in list(self._indexesPerElement.items()): + nFrames = self.configuration["frames"]["n_frames"] + all_velocities = np.empty((len(idxs), nFrames, 3), dtype=float) + + if self._mode == 1: + # Looping over elements is the only way to make repeated interpolation feasible at all + for i, __ in enumerate(idxs): + atomicTraj = read_atoms_trajectory( + traj, + [i], + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + variable=self.configuration["interpolation_order"][ + "variable" + ], + ) + for axis in range(3): + all_velocities[i, :, axis] = differentiate( + atomicTraj[:, axis], + order=self._order, + dt=self.configuration["frames"]["time_step"], + ) + elif self._mode == 2: + # Loading the whole trajectory of atoms of 1 element into memory can be faster than above, and + # is much faster than accessing the disk repeatedly, but it takes more memory too. + all_velocities[:, :, :] = self._velocities[idxs, :, :] + + for i, frame in enumerate(self.configuration["frames"]["value"]): + coordinates = traj.configuration[frame].array[idxs, :] + velocities = np.transpose(all_velocities[:, i, :])[:, :, np.newaxis] + tmp = np.exp(1j * np.dot(coordinates, qVectors))[np.newaxis, :, :] + rho[element][i, :, :] = np.add.reduce(velocities * tmp, 1) + + Q2 = np.sum(qVectors**2, axis=0) + + qj = np.sum(rho[element] * qVectors, axis=1) + rhoLong[element] = ( + qj[:, np.newaxis, :] * qVectors[np.newaxis, :, :] + ) / Q2 + rhoTrans[element] = rho[element] - rhoLong[element] + + # No interpolation and some interpolation approaches are faster when looping occurs primarily over frames + else: + # loop over the trajectory time steps + for i, frame in enumerate(self.configuration["frames"]["value"]): + conf = traj.configuration[frame] + + if self._order == "no interpolation": + vel = traj.velocities[frame].array + elif self._mode == 0: + vel = self._velocities[:, i, :] + else: + # When accessing disk repeatedly (minimum memory usage), it is faster to load a whole frame at once + # as it requires fewer I/O. This does take more memory, but only as much as if there were no + # interpolation, since that also loads one whole frame at a time. + if i % self._preload == 0: + try: + preloaded_velocities = self._velocities[ + :, [j + i for j in range(self._preload)], : + ] + except IndexError: + preloaded_velocities = vel = self._velocities[:, i:, :] + vel = preloaded_velocities[:, i % self._preload, :] + + for element, idxs in list(self._indexesPerElement.items()): + selectedCoordinates = conf.array[idxs, :] + selectedVelocities = vel[idxs, :] + selectedVelocities = np.transpose(selectedVelocities)[ + :, :, np.newaxis + ] + tmp = np.exp(1j * np.dot(selectedCoordinates, qVectors))[ + np.newaxis, :, : + ] + rho[element][i, :, :] = np.add.reduce(selectedVelocities * tmp, 1) + + Q2 = np.sum(qVectors**2, axis=0) + + for element in self._elements: + qj = np.sum(rho[element] * qVectors, axis=1) + rhoLong[element] = ( + qj[:, np.newaxis, :] * qVectors[np.newaxis, :, :] + ) / Q2 + rhoTrans[element] = rho[element] - rhoLong[element] + + return index, (rhoLong, rhoTrans) + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + if x is None: + return + + jLong, jTrans = x + + for at1, at2 in self._elementsPairs: + corrLong = np.zeros((self._nFrames,), dtype=np.float64) + corrTrans = np.zeros((self._nFrames,), dtype=np.float64) + + for i in range(3): + corrLong += correlation( + jLong[at1][:, i, :], jLong[at2][:, i, :], axis=0, average=1 + ) + corrTrans += correlation( + jTrans[at1][:, i, :], jTrans[at2][:, i, :], axis=0, average=1 + ) + + self._outputData["j(q,t)_long_%s%s" % (at1, at2)][index, :] += corrLong + self._outputData["j(q,t)_trans_%s%s" % (at1, at2)][index, :] += corrTrans + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...) + """ + try: + self._data_file.close() + except (AttributeError, RuntimeError): + pass + + try: + os.remove(os.path.join(tempdir, "mdanse_" + self.name + ".nc")) + except (OSError, AttributeError): + # OSError catches file not existing, and AttributeError caches gettempdir() having not been called + pass + + try: + del self._velocities + except AttributeError: + pass + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for pair in self._elementsPairs: + at1, at2 = pair + ni = nAtomsPerElement[at1] + nj = nAtomsPerElement[at2] + self._outputData["j(q,t)_long_%s%s" % pair][:] /= ni * nj + self._outputData["j(q,t)_trans_%s%s" % pair][:] /= ni * nj + self._outputData["J(q,f)_long_%s%s" % pair][:] = get_spectrum( + self._outputData["j(q,t)_long_%s%s" % pair], + self.configuration["instrument_resolution"]["time_window"], + self.configuration["instrument_resolution"]["time_step"], + axis=1, + ) + self._outputData["J(q,f)_trans_%s%s" % pair][:] = get_spectrum( + self._outputData["j(q,t)_trans_%s%s" % pair], + self.configuration["instrument_resolution"]["time_window"], + self.configuration["instrument_resolution"]["time_step"], + axis=1, + ) + + if self.configuration["normalize"]["value"]: + for pair in self._elementsPairs: + self._outputData["j(q,t)_long_%s%s" % pair] = normalize( + self._outputData["j(q,t)_long_%s%s" % pair], axis=1 + ) + self._outputData["j(q,t)_trans_%s%s" % pair] = normalize( + self._outputData["j(q,t)_trans_%s%s" % pair], axis=1 + ) + + jqtLongTotal = weight( + self.configuration["weights"].get_weights(), + self._outputData, + nAtomsPerElement, + 2, + "j(q,t)_long_%s%s", + ) + self._outputData["j(q,t)_long_total"][:] = jqtLongTotal + + jqtTransTotal = weight( + self.configuration["weights"].get_weights(), + self._outputData, + nAtomsPerElement, + 2, + "j(q,t)_trans_%s%s", + ) + self._outputData["j(q,t)_trans_total"][:] = jqtTransTotal + + sqfLongTotal = weight( + self.configuration["weights"].get_weights(), + self._outputData, + nAtomsPerElement, + 2, + "J(q,f)_long_%s%s", + ) + self._outputData["J(q,f)_long_total"][:] = sqfLongTotal + + sqfTransTotal = weight( + self.configuration["weights"].get_weights(), + self._outputData, + nAtomsPerElement, + 2, + "J(q,f)_trans_%s%s", + ) + self._outputData["J(q,f)_trans_total"][:] = sqfTransTotal + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Density.py b/MDANSE/Src/MDANSE/Framework/Jobs/Density.py index 6878578623..a711ac99d9 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Density.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Density.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/Density.py -# @brief Implements module/class/test Density +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py b/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py index 7c5fafc390..228a534e84 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py @@ -1,238 +1,242 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/DensityOfStates.py -# @brief Implements module/class/test DensityOfStates -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Arithmetic import weight -from MDANSE.Mathematics.Signal import correlation, differentiate, get_spectrum -from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms - - -class DensityOfStates(IJob): - """ - The Density Of States describes the number of vibrations per unit frequency. - It is determined as the power spectrum (Fourier transform) of the Velocity AutoCorrelation Function (VACF). - The partial Density of States corresponds to selected sets of atoms or molecules. - """ - - label = "Density Of States" - - category = ( - "Analysis", - "Dynamics", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["instrument_resolution"] = ( - "InstrumentResolutionConfigurator", - {"dependencies": {"trajectory": "trajectory", "frames": "frames"}}, - ) - settings["interpolation_order"] = ( - "InterpolationOrderConfigurator", - {"label": "velocities", "dependencies": {"trajectory": "trajectory"}}, - ) - settings["projection"] = ( - "ProjectionConfigurator", - {"label": "project coordinates"}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["weights"] = ( - "WeightsConfigurator", - {"dependencies": {"atom_selection": "atom_selection"}}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] - - instrResolution = self.configuration["instrument_resolution"] - - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["duration"], - units="ps", - ) - self._outputData.add( - "time_window", - "LineOutputVariable", - instrResolution["time_window"], - axis="time", - units="au", - ) - - self._outputData.add( - "omega", "LineOutputVariable", instrResolution["omega"], units="rad/ps" - ) - self._outputData.add( - "omega_window", - "LineOutputVariable", - instrResolution["omega_window"], - axis="omega", - units="au", - ) - - for element in self.configuration["atom_selection"]["unique_names"]: - self._outputData.add( - "vacf_%s" % element, - "LineOutputVariable", - (self.configuration["frames"]["number"],), - axis="time", - units="nm2/ps2", - ) - self._outputData.add( - "dos_%s" % element, - "LineOutputVariable", - (instrResolution["n_omegas"],), - axis="omega", - units="nm2/ps", - ) - self._outputData.add( - "vacf_total", - "LineOutputVariable", - (self.configuration["frames"]["number"],), - axis="time", - units="nm2/ps2", - ) - self._outputData.add( - "dos_total", - "LineOutputVariable", - (instrResolution["n_omegas"],), - axis="omega", - units="nm2/ps", - ) - - self._atoms = sorted_atoms( - self.configuration["trajectory"]["instance"].chemical_system.atom_list - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. atomicDOS (np.array): The calculated density of state for atom of index=index - #. atomicVACF (np.array): The calculated velocity auto-correlation function for atom of index=index - """ - - trajectory = self.configuration["trajectory"]["instance"] - - # get atom index - indexes = self.configuration["atom_selection"]["indexes"][index] - - if self.configuration["interpolation_order"]["value"] == 0: - series = trajectory.read_configuration_variable( - self.configuration["trajectory"]["instance"], - indexes[0], - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - variable="velocities", - ) - else: - series = trajectory.read_atomic_trajectory( - indexes[0], - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - order = self.configuration["interpolation_order"]["value"] - for axis in range(3): - series[:, axis] = differentiate( - series[:, axis], - order=order, - dt=self.configuration["frames"]["time_step"], - ) - - series = self.configuration["projection"]["projector"](series) - - atomicVACF = correlation(series, axis=0, average=1) - - return index, atomicVACF - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - # The symbol of the atom. - element = self.configuration["atom_selection"]["names"][index] - - self._outputData["vacf_%s" % element] += x - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for element, number in nAtomsPerElement.items(): - self._outputData["vacf_%s" % element][:] /= number - self._outputData["dos_%s" % element][:] = get_spectrum( - self._outputData["vacf_%s" % element], - self.configuration["instrument_resolution"]["time_window"], - self.configuration["instrument_resolution"]["time_step"], - ) - - weights = self.configuration["weights"].get_weights() - vacfTotal = weight(weights, self._outputData, nAtomsPerElement, 1, "vacf_%s") - self._outputData["vacf_total"][:] = vacfTotal - - dosTotal = weight(weights, self._outputData, nAtomsPerElement, 1, "dos_%s") - self._outputData["dos_total"][:] = dosTotal - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Arithmetic import weight +from MDANSE.Mathematics.Signal import correlation, differentiate, get_spectrum +from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms + + +class DensityOfStates(IJob): + """ + The Density Of States describes the number of vibrations per unit frequency. + It is determined as the power spectrum (Fourier transform) of the Velocity AutoCorrelation Function (VACF). + The partial Density of States corresponds to selected sets of atoms or molecules. + """ + + label = "Density Of States" + + category = ( + "Analysis", + "Dynamics", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["instrument_resolution"] = ( + "InstrumentResolutionConfigurator", + {"dependencies": {"trajectory": "trajectory", "frames": "frames"}}, + ) + settings["interpolation_order"] = ( + "InterpolationOrderConfigurator", + {"label": "velocities", "dependencies": {"trajectory": "trajectory"}}, + ) + settings["projection"] = ( + "ProjectionConfigurator", + {"label": "project coordinates"}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["weights"] = ( + "WeightsConfigurator", + {"dependencies": {"atom_selection": "atom_selection"}}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] + + instrResolution = self.configuration["instrument_resolution"] + + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["duration"], + units="ps", + ) + self._outputData.add( + "time_window", + "LineOutputVariable", + instrResolution["time_window"], + axis="time", + units="au", + ) + + self._outputData.add( + "omega", "LineOutputVariable", instrResolution["omega"], units="rad/ps" + ) + self._outputData.add( + "omega_window", + "LineOutputVariable", + instrResolution["omega_window"], + axis="omega", + units="au", + ) + + for element in self.configuration["atom_selection"]["unique_names"]: + self._outputData.add( + "vacf_%s" % element, + "LineOutputVariable", + (self.configuration["frames"]["number"],), + axis="time", + units="nm2/ps2", + ) + self._outputData.add( + "dos_%s" % element, + "LineOutputVariable", + (instrResolution["n_omegas"],), + axis="omega", + units="nm2/ps", + ) + self._outputData.add( + "vacf_total", + "LineOutputVariable", + (self.configuration["frames"]["number"],), + axis="time", + units="nm2/ps2", + ) + self._outputData.add( + "dos_total", + "LineOutputVariable", + (instrResolution["n_omegas"],), + axis="omega", + units="nm2/ps", + ) + + self._atoms = sorted_atoms( + self.configuration["trajectory"]["instance"].chemical_system.atom_list + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. atomicDOS (np.array): The calculated density of state for atom of index=index + #. atomicVACF (np.array): The calculated velocity auto-correlation function for atom of index=index + """ + + trajectory = self.configuration["trajectory"]["instance"] + + # get atom index + indexes = self.configuration["atom_selection"]["indexes"][index] + + if self.configuration["interpolation_order"]["value"] == 0: + series = trajectory.read_configuration_variable( + self.configuration["trajectory"]["instance"], + indexes[0], + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + variable="velocities", + ) + else: + series = trajectory.read_atomic_trajectory( + indexes[0], + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + order = self.configuration["interpolation_order"]["value"] + for axis in range(3): + series[:, axis] = differentiate( + series[:, axis], + order=order, + dt=self.configuration["frames"]["time_step"], + ) + + series = self.configuration["projection"]["projector"](series) + + atomicVACF = correlation(series, axis=0, average=1) + + return index, atomicVACF + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + # The symbol of the atom. + element = self.configuration["atom_selection"]["names"][index] + + self._outputData["vacf_%s" % element] += x + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for element, number in nAtomsPerElement.items(): + self._outputData["vacf_%s" % element][:] /= number + self._outputData["dos_%s" % element][:] = get_spectrum( + self._outputData["vacf_%s" % element], + self.configuration["instrument_resolution"]["time_window"], + self.configuration["instrument_resolution"]["time_step"], + ) + + weights = self.configuration["weights"].get_weights() + vacfTotal = weight(weights, self._outputData, nAtomsPerElement, 1, "vacf_%s") + self._outputData["vacf_total"][:] = vacfTotal + + dosTotal = weight(weights, self._outputData, nAtomsPerElement, 1, "dos_%s") + self._outputData["dos_total"][:] = dosTotal + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py b/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py index 834d08b08f..81010d3407 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py @@ -1,194 +1,198 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/DensityProfile.py -# @brief Implements module/class/test DensityProfile -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Core.Error import Error -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Arithmetic import weight - - -class DensityProfileError(Error): - pass - - -class DensityProfile(IJob): - """ - The Density Profile analysis shows the weighted atomic density heterogeneity in the directions of the simulation box axes. - For a lipid membrane, the density variation in the direction perpendicular to the membrane is probed in reflectometry measurements. - The Density Profile Analysis can show segregation or cluster order formation, for example during the formation of micelles. - """ - - label = "Density Profile" - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["axis"] = ( - "SingleChoiceConfigurator", - {"choices": ["a", "b", "c"], "default": "c"}, - ) - settings["dr"] = ("FloatConfigurator", {"default": 0.01, "mini": 1.0e-9}) - settings["weights"] = ( - "WeightsConfigurator", - {"dependencies": {"atom_selection": "atom_selection"}}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - # The number of steps of the analysis. - self.numberOfSteps = self.configuration["frames"]["number"] - - self._dr = self.configuration["dr"]["value"] - - axis_index = self.configuration["axis"]["index"] - - first_conf = self.configuration["trajectory"][ - "instance" - ].chemical_system.configuration - if not first_conf.is_periodic: - raise DensityProfileError( - "Density profile cannot be computed for chemical system without periodc boundary conditions" - ) - - axis = first_conf.unit_cell.direct[axis_index, :] - axis_length = np.sqrt(np.sum(axis**2)) - self._n_bins = int(axis_length / self._dr) + 1 - - self._outputData.add("r", "LineOutputVariable", (self._n_bins,), units="nm") - - self._indexes_per_element = self.configuration["atom_selection"].get_indexes() - - for element in self._indexes_per_element.keys(): - self._outputData.add( - "dp_%s" % element, - "LineOutputVariable", - (self._n_bins,), - axis="r", - units="au", - ) - - self._extent = 0.0 - - def run_step(self, index): - """ - Runs a single step of the job. - - @param index: the index of the step. - @type index: int. - """ - - # get the Frame index - frame_index = self.configuration["frames"]["value"][index] - - conf = self.configuration["trajectory"]["instance"].configuration(frame_index) - - box_coords = conf.to_box_coordinates() - - axis_index = self.configuration["axis"]["index"] - axis = conf.unit_cell.direct[axis_index, :] - axis_length = np.sqrt(np.sum(axis**2)) - - dp_per_frame = {} - - for k, v in self._indexes_per_element.items(): - h = np.histogram( - box_coords[v, axis_index], bins=self._n_bins, range=[-0.5, 0.5] - ) - dp_per_frame[k] = h[0] - - return index, (axis_length, dp_per_frame) - - def combine(self, index, x): - """ - @param index: the index of the step. - @type index: int. - - @param x: - @type x: any. - """ - - self._extent += x[0] - - for element, hist in list(x[1].items()): - self._outputData["dp_%s" % element] += hist - - def finalize(self): - """ - Finalize the job. - """ - - n_atoms_per_element = self.configuration["atom_selection"].get_natoms() - for element in n_atoms_per_element.keys(): - self._outputData["dp_%s" % element] += self.numberOfSteps - - dp_total = weight( - self.configuration["weights"].get_weights(), - self._outputData, - n_atoms_per_element, - 1, - "dp_%s", - ) - - self._outputData.add( - "dp_total", "LineOutputVariable", dp_total, axis="r", units="au" - ) - - self._extent /= self.numberOfSteps - - r_values = self._extent * np.linspace(0, 1, self._n_bins + 1) - self._outputData["r"][:] = (r_values[1:] + r_values[:-1]) / 2 - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Core.Error import Error +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Arithmetic import weight + + +class DensityProfileError(Error): + pass + + +class DensityProfile(IJob): + """ + The Density Profile analysis shows the weighted atomic density heterogeneity in the directions of the simulation box axes. + For a lipid membrane, the density variation in the direction perpendicular to the membrane is probed in reflectometry measurements. + The Density Profile Analysis can show segregation or cluster order formation, for example during the formation of micelles. + """ + + label = "Density Profile" + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["axis"] = ( + "SingleChoiceConfigurator", + {"choices": ["a", "b", "c"], "default": "c"}, + ) + settings["dr"] = ("FloatConfigurator", {"default": 0.01, "mini": 1.0e-9}) + settings["weights"] = ( + "WeightsConfigurator", + {"dependencies": {"atom_selection": "atom_selection"}}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + # The number of steps of the analysis. + self.numberOfSteps = self.configuration["frames"]["number"] + + self._dr = self.configuration["dr"]["value"] + + axis_index = self.configuration["axis"]["index"] + + first_conf = self.configuration["trajectory"][ + "instance" + ].chemical_system.configuration + if not first_conf.is_periodic: + raise DensityProfileError( + "Density profile cannot be computed for chemical system without periodc boundary conditions" + ) + + axis = first_conf.unit_cell.direct[axis_index, :] + axis_length = np.sqrt(np.sum(axis**2)) + self._n_bins = int(axis_length / self._dr) + 1 + + self._outputData.add("r", "LineOutputVariable", (self._n_bins,), units="nm") + + self._indexes_per_element = self.configuration["atom_selection"].get_indexes() + + for element in self._indexes_per_element.keys(): + self._outputData.add( + "dp_%s" % element, + "LineOutputVariable", + (self._n_bins,), + axis="r", + units="au", + ) + + self._extent = 0.0 + + def run_step(self, index): + """ + Runs a single step of the job. + + @param index: the index of the step. + @type index: int. + """ + + # get the Frame index + frame_index = self.configuration["frames"]["value"][index] + + conf = self.configuration["trajectory"]["instance"].configuration(frame_index) + + box_coords = conf.to_box_coordinates() + + axis_index = self.configuration["axis"]["index"] + axis = conf.unit_cell.direct[axis_index, :] + axis_length = np.sqrt(np.sum(axis**2)) + + dp_per_frame = {} + + for k, v in self._indexes_per_element.items(): + h = np.histogram( + box_coords[v, axis_index], bins=self._n_bins, range=[-0.5, 0.5] + ) + dp_per_frame[k] = h[0] + + return index, (axis_length, dp_per_frame) + + def combine(self, index, x): + """ + @param index: the index of the step. + @type index: int. + + @param x: + @type x: any. + """ + + self._extent += x[0] + + for element, hist in list(x[1].items()): + self._outputData["dp_%s" % element] += hist + + def finalize(self): + """ + Finalize the job. + """ + + n_atoms_per_element = self.configuration["atom_selection"].get_natoms() + for element in n_atoms_per_element.keys(): + self._outputData["dp_%s" % element] += self.numberOfSteps + + dp_total = weight( + self.configuration["weights"].get_weights(), + self._outputData, + n_atoms_per_element, + 1, + "dp_%s", + ) + + self._outputData.add( + "dp_total", "LineOutputVariable", dp_total, axis="r", units="au" + ) + + self._extent /= self.numberOfSteps + + r_values = self._extent * np.linspace(0, 1, self._n_bins + 1) + self._outputData["r"][:] = (r_values[1:] + r_values[:-1]) / 2 + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py index 20287f29a9..055e3cd053 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/DipoleAutoCorrelationFunction.py -# @brief Implements module/class/test DipoleAutoCorrelationFunction +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py b/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py index 6d65ed6c52..6623aaad4f 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py @@ -1,212 +1,216 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/DistanceHistogram.py -# @brief Implements module/class/test DistanceHistogram -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import itertools - -import numpy as np - -from MDANSE.Core.Error import Error -from MDANSE.Extensions import distance_histogram -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.MolecularDynamics.TrajectoryUtils import atom_index_to_molecule_index - - -class DistanceHistogram(IJob): - """ - Compute the Histogram of Distance, used by e.g. PDF, coordination number analysis - """ - - type = None - - enabled = False - - category = ( - "Analysis", - "Structure", - ) - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["r_values"] = ( - "RangeConfigurator", - { - "label": "r values (nm)", - "valueType": float, - "includeLast": True, - "mini": 0.0, - }, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["weights"] = ( - "WeightsConfigurator", - {"dependencies": {"atom_selection": "atom_selection"}}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["frames"]["number"] - - self._indexes = [ - idx - for idxs in self.configuration["atom_selection"]["indexes"] - for idx in idxs - ] - self._indexes = np.array(self._indexes, dtype=np.int32) - - self.selectedElements = self.configuration["atom_selection"]["unique_names"] - - self.indexToSymbol = np.array( - [ - self.selectedElements.index(name) - for name in self.configuration["atom_selection"]["names"] - ], - dtype=np.int32, - ) - - lut = atom_index_to_molecule_index( - self.configuration["trajectory"]["instance"].chemical_system - ) - - self.indexToMolecule = np.array([lut[i] for i in self._indexes], dtype=np.int32) - - nElements = len(self.selectedElements) - - # The histogram of the intramolecular distances. - self.hIntra = np.zeros( - (nElements, nElements, len(self.configuration["r_values"]["mid_points"])), - dtype=np.float64, - ) - - # The histogram of the intermolecular distances. - self.hInter = np.zeros( - (nElements, nElements, len(self.configuration["r_values"]["mid_points"])), - dtype=np.float64, - ) - - self.scaleconfig = np.zeros( - (self.configuration["atom_selection"]["selection_length"], 3), - dtype=np.float64, - ) - - self.averageDensity = 0.0 - - self._nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - self._concentrations = {} - for k in list(self._nAtomsPerElement.keys()): - self._concentrations[k] = 0.0 - - self._elementsPairs = sorted( - itertools.combinations_with_replacement(self.selectedElements, 2) - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. cellVolume (float): the volume of the current frame simulation box - #. hIntraTemp (np.array): The calculated distance intra-molecular histogram - #. hInterTemp (np.array): The calculated distance inter-molecular histogram - """ - - # get the Frame index - frame_index = self.configuration["frames"]["value"][index] - - conf = self.configuration["trajectory"]["instance"].configuration(frame_index) - - if not conf.is_periodic: - raise Error( - "Pair distribution function cannot be calculated for infinite universe trajectories" - ) - - direct_cell = conf.unit_cell.transposed_direct - inverse_cell = conf.unit_cell.transposed_inverse - - cell_volume = conf.unit_cell.volume - - coords = conf["coordinates"] - - hIntraTemp = np.zeros(self.hIntra.shape, dtype=np.float64) - hInterTemp = np.zeros(self.hInter.shape, dtype=np.float64) - - distance_histogram.distance_histogram( - coords[self._indexes, :], - direct_cell, - inverse_cell, - self._indexes, - self.indexToMolecule, - self.indexToSymbol, - hIntraTemp, - hInterTemp, - self.scaleconfig, - self.configuration["r_values"]["first"], - self.configuration["r_values"]["step"], - ) - - np.multiply(hIntraTemp, cell_volume, hIntraTemp) - np.multiply(hInterTemp, cell_volume, hInterTemp) - - return index, (cell_volume, hIntraTemp, hInterTemp) - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - nAtoms = self.configuration["trajectory"][ - "instance" - ].chemical_system.number_of_atoms - - self.averageDensity += nAtoms / x[0] - - # The temporary distance histograms are normalized by the volume. This is done for each step because the - # volume can variate during the MD (e.g. NPT conditions). This volume is the one that intervene in the density - # calculation. - self.hIntra += x[1] - self.hInter += x[2] - - for k, v in list(self._nAtomsPerElement.items()): - self._concentrations[k] += float(v) / nAtoms +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import itertools + +import numpy as np + +from MDANSE.Core.Error import Error +from MDANSE.Extensions import distance_histogram +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.MolecularDynamics.TrajectoryUtils import atom_index_to_molecule_index + + +class DistanceHistogram(IJob): + """ + Compute the Histogram of Distance, used by e.g. PDF, coordination number analysis + """ + + type = None + + enabled = False + + category = ( + "Analysis", + "Structure", + ) + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["r_values"] = ( + "RangeConfigurator", + { + "label": "r values (nm)", + "valueType": float, + "includeLast": True, + "mini": 0.0, + }, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["weights"] = ( + "WeightsConfigurator", + {"dependencies": {"atom_selection": "atom_selection"}}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["frames"]["number"] + + self._indexes = [ + idx + for idxs in self.configuration["atom_selection"]["indexes"] + for idx in idxs + ] + self._indexes = np.array(self._indexes, dtype=np.int32) + + self.selectedElements = self.configuration["atom_selection"]["unique_names"] + + self.indexToSymbol = np.array( + [ + self.selectedElements.index(name) + for name in self.configuration["atom_selection"]["names"] + ], + dtype=np.int32, + ) + + lut = atom_index_to_molecule_index( + self.configuration["trajectory"]["instance"].chemical_system + ) + + self.indexToMolecule = np.array([lut[i] for i in self._indexes], dtype=np.int32) + + nElements = len(self.selectedElements) + + # The histogram of the intramolecular distances. + self.hIntra = np.zeros( + (nElements, nElements, len(self.configuration["r_values"]["mid_points"])), + dtype=np.float64, + ) + + # The histogram of the intermolecular distances. + self.hInter = np.zeros( + (nElements, nElements, len(self.configuration["r_values"]["mid_points"])), + dtype=np.float64, + ) + + self.scaleconfig = np.zeros( + (self.configuration["atom_selection"]["selection_length"], 3), + dtype=np.float64, + ) + + self.averageDensity = 0.0 + + self._nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + self._concentrations = {} + for k in list(self._nAtomsPerElement.keys()): + self._concentrations[k] = 0.0 + + self._elementsPairs = sorted( + itertools.combinations_with_replacement(self.selectedElements, 2) + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. cellVolume (float): the volume of the current frame simulation box + #. hIntraTemp (np.array): The calculated distance intra-molecular histogram + #. hInterTemp (np.array): The calculated distance inter-molecular histogram + """ + + # get the Frame index + frame_index = self.configuration["frames"]["value"][index] + + conf = self.configuration["trajectory"]["instance"].configuration(frame_index) + + if not conf.is_periodic: + raise Error( + "Pair distribution function cannot be calculated for infinite universe trajectories" + ) + + direct_cell = conf.unit_cell.transposed_direct + inverse_cell = conf.unit_cell.transposed_inverse + + cell_volume = conf.unit_cell.volume + + coords = conf["coordinates"] + + hIntraTemp = np.zeros(self.hIntra.shape, dtype=np.float64) + hInterTemp = np.zeros(self.hInter.shape, dtype=np.float64) + + distance_histogram.distance_histogram( + coords[self._indexes, :], + direct_cell, + inverse_cell, + self._indexes, + self.indexToMolecule, + self.indexToSymbol, + hIntraTemp, + hInterTemp, + self.scaleconfig, + self.configuration["r_values"]["first"], + self.configuration["r_values"]["step"], + ) + + np.multiply(hIntraTemp, cell_volume, hIntraTemp) + np.multiply(hInterTemp, cell_volume, hInterTemp) + + return index, (cell_volume, hIntraTemp, hInterTemp) + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + nAtoms = self.configuration["trajectory"][ + "instance" + ].chemical_system.number_of_atoms + + self.averageDensity += nAtoms / x[0] + + # The temporary distance histograms are normalized by the volume. This is done for each step because the + # volume can variate during the MD (e.g. NPT conditions). This volume is the one that intervene in the density + # calculation. + self.hIntra += x[1] + self.hInter += x[2] + + for k, v in list(self._nAtomsPerElement.items()): + self._concentrations[k] += float(v) / nAtoms diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py index d79e3b3d5f..47104e6e90 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py @@ -1,288 +1,292 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/DynamicCoherentStructureFactor.py -# @brief Implements module/class/test DynamicCoherentStructureFactor -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import itertools - -import numpy as np - - -from MDANSE.Core.Error import Error -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Arithmetic import weight -from MDANSE.Mathematics.Signal import correlation, get_spectrum - - -class DynamicCoherentStructureFactorError(Error): - pass - - -class DynamicCoherentStructureFactor(IJob): - """ - Computes the dynamic coherent structure factor S_coh(Q,w) for a set of atoms. - It can be compared to experimental data e.g. the energy-integrated, static structure factor S_coh(Q) - or the dispersion and intensity of phonons. - """ - - label = "Dynamic Coherent Structure Factor" - - category = ( - "Analysis", - "Scattering", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["instrument_resolution"] = ( - "InstrumentResolutionConfigurator", - {"dependencies": {"trajectory": "trajectory", "frames": "frames"}}, - ) - settings["q_vectors"] = ( - "QVectorsConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["weights"] = ( - "WeightsConfigurator", - { - "default": "b_coherent", - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - "atom_transmutation": "atom_transmutation", - }, - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - if not self.configuration["trajectory"][ - "instance" - ].chemical_system.configuration.is_periodic: - raise DynamicCoherentStructureFactorError( - "Cannot start %s analysis on non-periodic system" % self.label - ) - - if not self.configuration["q_vectors"]["is_lattice"]: - raise DynamicCoherentStructureFactorError( - "The Q vectors must be generated on a lattice to run %s analysis" - % self.label - ) - - self.numberOfSteps = self.configuration["q_vectors"]["n_shells"] - - nQShells = self.configuration["q_vectors"]["n_shells"] - - self._nFrames = self.configuration["frames"]["number"] - - self._instrResolution = self.configuration["instrument_resolution"] - - self._nOmegas = self._instrResolution["n_omegas"] - - self._outputData.add( - "q", - "LineOutputVariable", - self.configuration["q_vectors"]["shells"], - units="1/nm", - ) - - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["duration"], - units="ps", - ) - self._outputData.add( - "time_window", - "LineOutputVariable", - self._instrResolution["time_window"], - units="au", - ) - - self._outputData.add( - "omega", - "LineOutputVariable", - self._instrResolution["omega"], - units="rad/ps", - ) - self._outputData.add( - "omega_window", - "LineOutputVariable", - self._instrResolution["omega_window"], - axis="omega", - units="au", - ) - - self._elementsPairs = sorted( - itertools.combinations_with_replacement( - self.configuration["atom_selection"]["unique_names"], 2 - ) - ) - self._indexesPerElement = self.configuration["atom_selection"].get_indexes() - - for pair in self._elementsPairs: - self._outputData.add( - "f(q,t)_%s%s" % pair, - "SurfaceOutputVariable", - (nQShells, self._nFrames), - axis="q|time", - units="au", - ) - self._outputData.add( - "s(q,f)_%s%s" % pair, - "SurfaceOutputVariable", - (nQShells, self._nOmegas), - axis="q|omega", - units="nm2/ps", - ) - - self._outputData.add( - "f(q,t)_total", - "SurfaceOutputVariable", - (nQShells, self._nFrames), - axis="q|time", - units="au", - ) - self._outputData.add( - "s(q,f)_total", - "SurfaceOutputVariable", - (nQShells, self._nOmegas), - axis="q|omega", - units="nm2/ps", - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. rho (np.array): The exponential part of I(k,t) - """ - - shell = self.configuration["q_vectors"]["shells"][index] - - if not shell in self.configuration["q_vectors"]["value"]: - return index, None - - else: - traj = self.configuration["trajectory"]["instance"] - - nQVectors = self.configuration["q_vectors"]["value"][shell][ - "q_vectors" - ].shape[1] - - rho = {} - for element in self.configuration["atom_selection"]["unique_names"]: - rho[element] = np.zeros((self._nFrames, nQVectors), dtype=np.complex64) - - # loop over the trajectory time steps - for i, frame in enumerate(self.configuration["frames"]["value"]): - qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"] - - coords = traj.configuration(frame)["coordinates"] - - for element, idxs in self._indexesPerElement.items(): - selectedCoordinates = np.take(coords, idxs, axis=0) - rho[element][i, :] = np.sum( - np.exp(1j * np.dot(selectedCoordinates, qVectors)), axis=0 - ) - - return index, rho - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - if x is not None: - for pair in self._elementsPairs: - corr = correlation(x[pair[0]], x[pair[1]], average=1) - self._outputData["f(q,t)_%s%s" % pair][index, :] += corr - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...) - """ - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for pair in self._elementsPairs: - ni = nAtomsPerElement[pair[0]] - nj = nAtomsPerElement[pair[1]] - self._outputData["f(q,t)_%s%s" % pair][:] /= np.sqrt(ni * nj) - self._outputData["s(q,f)_%s%s" % pair][:] = get_spectrum( - self._outputData["f(q,t)_%s%s" % pair], - self.configuration["instrument_resolution"]["time_window"], - self.configuration["instrument_resolution"]["time_step"], - axis=1, - ) - - fqtTotal = weight( - self.configuration["weights"].get_weights(), - self._outputData, - nAtomsPerElement, - 2, - "f(q,t)_%s%s", - ) - - self._outputData["f(q,t)_total"][:] = fqtTotal - - sqfTotal = weight( - self.configuration["weights"].get_weights(), - self._outputData, - nAtomsPerElement, - 2, - "s(q,f)_%s%s", - ) - self._outputData["s(q,f)_total"][:] = sqfTotal - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import itertools + +import numpy as np + + +from MDANSE.Core.Error import Error +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Arithmetic import weight +from MDANSE.Mathematics.Signal import correlation, get_spectrum + + +class DynamicCoherentStructureFactorError(Error): + pass + + +class DynamicCoherentStructureFactor(IJob): + """ + Computes the dynamic coherent structure factor S_coh(Q,w) for a set of atoms. + It can be compared to experimental data e.g. the energy-integrated, static structure factor S_coh(Q) + or the dispersion and intensity of phonons. + """ + + label = "Dynamic Coherent Structure Factor" + + category = ( + "Analysis", + "Scattering", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["instrument_resolution"] = ( + "InstrumentResolutionConfigurator", + {"dependencies": {"trajectory": "trajectory", "frames": "frames"}}, + ) + settings["q_vectors"] = ( + "QVectorsConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["weights"] = ( + "WeightsConfigurator", + { + "default": "b_coherent", + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + "atom_transmutation": "atom_transmutation", + }, + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + if not self.configuration["trajectory"][ + "instance" + ].chemical_system.configuration.is_periodic: + raise DynamicCoherentStructureFactorError( + "Cannot start %s analysis on non-periodic system" % self.label + ) + + if not self.configuration["q_vectors"]["is_lattice"]: + raise DynamicCoherentStructureFactorError( + "The Q vectors must be generated on a lattice to run %s analysis" + % self.label + ) + + self.numberOfSteps = self.configuration["q_vectors"]["n_shells"] + + nQShells = self.configuration["q_vectors"]["n_shells"] + + self._nFrames = self.configuration["frames"]["number"] + + self._instrResolution = self.configuration["instrument_resolution"] + + self._nOmegas = self._instrResolution["n_omegas"] + + self._outputData.add( + "q", + "LineOutputVariable", + self.configuration["q_vectors"]["shells"], + units="1/nm", + ) + + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["duration"], + units="ps", + ) + self._outputData.add( + "time_window", + "LineOutputVariable", + self._instrResolution["time_window"], + units="au", + ) + + self._outputData.add( + "omega", + "LineOutputVariable", + self._instrResolution["omega"], + units="rad/ps", + ) + self._outputData.add( + "omega_window", + "LineOutputVariable", + self._instrResolution["omega_window"], + axis="omega", + units="au", + ) + + self._elementsPairs = sorted( + itertools.combinations_with_replacement( + self.configuration["atom_selection"]["unique_names"], 2 + ) + ) + self._indexesPerElement = self.configuration["atom_selection"].get_indexes() + + for pair in self._elementsPairs: + self._outputData.add( + "f(q,t)_%s%s" % pair, + "SurfaceOutputVariable", + (nQShells, self._nFrames), + axis="q|time", + units="au", + ) + self._outputData.add( + "s(q,f)_%s%s" % pair, + "SurfaceOutputVariable", + (nQShells, self._nOmegas), + axis="q|omega", + units="nm2/ps", + ) + + self._outputData.add( + "f(q,t)_total", + "SurfaceOutputVariable", + (nQShells, self._nFrames), + axis="q|time", + units="au", + ) + self._outputData.add( + "s(q,f)_total", + "SurfaceOutputVariable", + (nQShells, self._nOmegas), + axis="q|omega", + units="nm2/ps", + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. rho (np.array): The exponential part of I(k,t) + """ + + shell = self.configuration["q_vectors"]["shells"][index] + + if not shell in self.configuration["q_vectors"]["value"]: + return index, None + + else: + traj = self.configuration["trajectory"]["instance"] + + nQVectors = self.configuration["q_vectors"]["value"][shell][ + "q_vectors" + ].shape[1] + + rho = {} + for element in self.configuration["atom_selection"]["unique_names"]: + rho[element] = np.zeros((self._nFrames, nQVectors), dtype=np.complex64) + + # loop over the trajectory time steps + for i, frame in enumerate(self.configuration["frames"]["value"]): + qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"] + + coords = traj.configuration(frame)["coordinates"] + + for element, idxs in self._indexesPerElement.items(): + selectedCoordinates = np.take(coords, idxs, axis=0) + rho[element][i, :] = np.sum( + np.exp(1j * np.dot(selectedCoordinates, qVectors)), axis=0 + ) + + return index, rho + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + if x is not None: + for pair in self._elementsPairs: + corr = correlation(x[pair[0]], x[pair[1]], average=1) + self._outputData["f(q,t)_%s%s" % pair][index, :] += corr + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...) + """ + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for pair in self._elementsPairs: + ni = nAtomsPerElement[pair[0]] + nj = nAtomsPerElement[pair[1]] + self._outputData["f(q,t)_%s%s" % pair][:] /= np.sqrt(ni * nj) + self._outputData["s(q,f)_%s%s" % pair][:] = get_spectrum( + self._outputData["f(q,t)_%s%s" % pair], + self.configuration["instrument_resolution"]["time_window"], + self.configuration["instrument_resolution"]["time_step"], + axis=1, + ) + + fqtTotal = weight( + self.configuration["weights"].get_weights(), + self._outputData, + nAtomsPerElement, + 2, + "f(q,t)_%s%s", + ) + + self._outputData["f(q,t)_total"][:] = fqtTotal + + sqfTotal = weight( + self.configuration["weights"].get_weights(), + self._outputData, + nAtomsPerElement, + 2, + "s(q,f)_%s%s", + ) + self._outputData["s(q,f)_total"][:] = sqfTotal + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py index b2e3c32a86..13b144a07b 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py @@ -1,275 +1,279 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/DynamicIncoherentStructureFactor.py -# @brief Implements module/class/test DynamicIncoherentStructureFactor -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Arithmetic import weight -from MDANSE.Mathematics.Signal import correlation, get_spectrum -from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms - - -class DynamicIncoherentStructureFactor(IJob): - """ - Computes the dynamic incoherent structure factor S_inc(Q,w) for a set of atoms. - It can be compared to experimental data e.g. the quasielastic scattering due to diffusion processes. - """ - - label = "Dynamic Incoherent Structure Factor" - - category = ( - "Analysis", - "Scattering", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["instrument_resolution"] = ( - "InstrumentResolutionConfigurator", - {"dependencies": {"trajectory": "trajectory", "frames": "frames"}}, - ) - settings["q_vectors"] = ( - "QVectorsConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["grouping_level"] = ( - "GroupingLevelConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - "atom_transmutation": "atom_transmutation", - } - }, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["projection"] = ( - "ProjectionConfigurator", - {"label": "project coordinates"}, - ) - settings["weights"] = ( - "WeightsConfigurator", - { - "default": "b_incoherent2", - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - "atom_transmutation": "atom_transmutation", - }, - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] - - self._nQShells = self.configuration["q_vectors"]["n_shells"] - - self._nFrames = self.configuration["frames"]["number"] - - self._instrResolution = self.configuration["instrument_resolution"] - - self._atoms = sorted_atoms( - self.configuration["trajectory"]["instance"].chemical_system.atom_list - ) - - self._nOmegas = self._instrResolution["n_omegas"] - - self._outputData.add( - "q", - "LineOutputVariable", - self.configuration["q_vectors"]["shells"], - units="1/nm", - ) - - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["duration"], - units="ps", - ) - self._outputData.add( - "time_window", - "LineOutputVariable", - self._instrResolution["time_window"], - units="au", - ) - - self._outputData.add( - "omega", - "LineOutputVariable", - self._instrResolution["omega"], - units="rad/ps", - ) - self._outputData.add( - "omega_window", - "LineOutputVariable", - self._instrResolution["omega_window"], - axis="omega", - units="au", - ) - - for element in self.configuration["atom_selection"]["unique_names"]: - self._outputData.add( - "f(q,t)_%s" % element, - "SurfaceOutputVariable", - (self._nQShells, self._nFrames), - axis="q|time", - units="au", - ) - self._outputData.add( - "s(q,f)_%s" % element, - "SurfaceOutputVariable", - (self._nQShells, self._nOmegas), - axis="q|omega", - units="nm2/ps", - ) - - self._outputData.add( - "f(q,t)_total", - "SurfaceOutputVariable", - (self._nQShells, self._nFrames), - axis="q|time", - units="au", - ) - self._outputData.add( - "s(q,f)_total", - "SurfaceOutputVariable", - (self._nQShells, self._nOmegas), - axis="q|omega", - units="nm2/ps", - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. atomicSF (np.array): The atomic structure factor - """ - - indexes = self.configuration["atom_selection"]["indexes"][index] - - if len(indexes) == 1: - series = self.configuration["trajectory"][ - "instance" - ].read_atomic_trajectory( - indexes[0], - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - else: - selected_atoms = [self._atoms[idx] for idx in indexes] - series = self.configuration["trajectory"]["instance"].read_com_trajectory( - selected_atoms, - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - series = self.configuration["projection"]["projector"](series) - - disf_per_q_shell = collections.OrderedDict() - for q in self.configuration["q_vectors"]["shells"]: - disf_per_q_shell[q] = np.zeros((self._nFrames,), dtype=np.float64) - - for q in self.configuration["q_vectors"]["shells"]: - qVectors = self.configuration["q_vectors"]["value"][q]["q_vectors"] - - rho = np.exp(1j * np.dot(series, qVectors)) - res = correlation(rho, axis=0, average=1) - - disf_per_q_shell[q] += res - - return index, disf_per_q_shell - - def combine(self, index, disf_per_q_shell): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - element = self.configuration["atom_selection"]["names"][index] - for i, v in enumerate(disf_per_q_shell.values()): - self._outputData["f(q,t)_{}".format(element)][i, :] += v - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...) - """ - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for element, number in list(nAtomsPerElement.items()): - self._outputData["f(q,t)_%s" % element][:] /= number - self._outputData["s(q,f)_%s" % element][:] = get_spectrum( - self._outputData["f(q,t)_%s" % element], - self.configuration["instrument_resolution"]["time_window"], - self.configuration["instrument_resolution"]["time_step"], - axis=1, - ) - - weights = self.configuration["weights"].get_weights() - - self._outputData["f(q,t)_total"][:] = weight( - weights, self._outputData, nAtomsPerElement, 1, "f(q,t)_%s" - ) - - self._outputData["s(q,f)_total"][:] = weight( - weights, self._outputData, nAtomsPerElement, 1, "s(q,f)_%s" - ) - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Arithmetic import weight +from MDANSE.Mathematics.Signal import correlation, get_spectrum +from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms + + +class DynamicIncoherentStructureFactor(IJob): + """ + Computes the dynamic incoherent structure factor S_inc(Q,w) for a set of atoms. + It can be compared to experimental data e.g. the quasielastic scattering due to diffusion processes. + """ + + label = "Dynamic Incoherent Structure Factor" + + category = ( + "Analysis", + "Scattering", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["instrument_resolution"] = ( + "InstrumentResolutionConfigurator", + {"dependencies": {"trajectory": "trajectory", "frames": "frames"}}, + ) + settings["q_vectors"] = ( + "QVectorsConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["grouping_level"] = ( + "GroupingLevelConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + "atom_transmutation": "atom_transmutation", + } + }, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["projection"] = ( + "ProjectionConfigurator", + {"label": "project coordinates"}, + ) + settings["weights"] = ( + "WeightsConfigurator", + { + "default": "b_incoherent2", + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + "atom_transmutation": "atom_transmutation", + }, + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] + + self._nQShells = self.configuration["q_vectors"]["n_shells"] + + self._nFrames = self.configuration["frames"]["number"] + + self._instrResolution = self.configuration["instrument_resolution"] + + self._atoms = sorted_atoms( + self.configuration["trajectory"]["instance"].chemical_system.atom_list + ) + + self._nOmegas = self._instrResolution["n_omegas"] + + self._outputData.add( + "q", + "LineOutputVariable", + self.configuration["q_vectors"]["shells"], + units="1/nm", + ) + + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["duration"], + units="ps", + ) + self._outputData.add( + "time_window", + "LineOutputVariable", + self._instrResolution["time_window"], + units="au", + ) + + self._outputData.add( + "omega", + "LineOutputVariable", + self._instrResolution["omega"], + units="rad/ps", + ) + self._outputData.add( + "omega_window", + "LineOutputVariable", + self._instrResolution["omega_window"], + axis="omega", + units="au", + ) + + for element in self.configuration["atom_selection"]["unique_names"]: + self._outputData.add( + "f(q,t)_%s" % element, + "SurfaceOutputVariable", + (self._nQShells, self._nFrames), + axis="q|time", + units="au", + ) + self._outputData.add( + "s(q,f)_%s" % element, + "SurfaceOutputVariable", + (self._nQShells, self._nOmegas), + axis="q|omega", + units="nm2/ps", + ) + + self._outputData.add( + "f(q,t)_total", + "SurfaceOutputVariable", + (self._nQShells, self._nFrames), + axis="q|time", + units="au", + ) + self._outputData.add( + "s(q,f)_total", + "SurfaceOutputVariable", + (self._nQShells, self._nOmegas), + axis="q|omega", + units="nm2/ps", + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. atomicSF (np.array): The atomic structure factor + """ + + indexes = self.configuration["atom_selection"]["indexes"][index] + + if len(indexes) == 1: + series = self.configuration["trajectory"][ + "instance" + ].read_atomic_trajectory( + indexes[0], + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + else: + selected_atoms = [self._atoms[idx] for idx in indexes] + series = self.configuration["trajectory"]["instance"].read_com_trajectory( + selected_atoms, + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + series = self.configuration["projection"]["projector"](series) + + disf_per_q_shell = collections.OrderedDict() + for q in self.configuration["q_vectors"]["shells"]: + disf_per_q_shell[q] = np.zeros((self._nFrames,), dtype=np.float64) + + for q in self.configuration["q_vectors"]["shells"]: + qVectors = self.configuration["q_vectors"]["value"][q]["q_vectors"] + + rho = np.exp(1j * np.dot(series, qVectors)) + res = correlation(rho, axis=0, average=1) + + disf_per_q_shell[q] += res + + return index, disf_per_q_shell + + def combine(self, index, disf_per_q_shell): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + element = self.configuration["atom_selection"]["names"][index] + for i, v in enumerate(disf_per_q_shell.values()): + self._outputData["f(q,t)_{}".format(element)][i, :] += v + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...) + """ + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for element, number in list(nAtomsPerElement.items()): + self._outputData["f(q,t)_%s" % element][:] /= number + self._outputData["s(q,f)_%s" % element][:] = get_spectrum( + self._outputData["f(q,t)_%s" % element], + self.configuration["instrument_resolution"]["time_window"], + self.configuration["instrument_resolution"]["time_step"], + axis=1, + ) + + weights = self.configuration["weights"].get_weights() + + self._outputData["f(q,t)_total"][:] = weight( + weights, self._outputData, nAtomsPerElement, 1, "f(q,t)_%s" + ) + + self._outputData["s(q,f)_total"][:] = weight( + weights, self._outputData, nAtomsPerElement, 1, "s(q,f)_%s" + ) + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py b/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py index 302afb9622..2febc67ae8 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/Eccentricity.py -# @brief Implements module/class/test Eccentricity +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py index 85c98f9c75..ecedf4f7f2 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py @@ -1,202 +1,206 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/ElasticIncoherentStructureFactor.py -# @brief Implements module/class/test ElasticIncoherentStructureFactor -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Arithmetic import weight -from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms - - -class ElasticIncoherentStructureFactor(IJob): - """ - The Elastic Incoherent Structure Factor (EISF ) is defined as the limit of the incoherent - intermediate scattering function for infinite time. - - The EISF appears as the incoherent amplitude of the elastic line in the neutron scattering spectrum. - Elastic scattering is only present for systems in which the atomic motion is confined in space, as - in solids. The Q-dependence of the EISF indicates e.g. the fraction of static/mobile atoms and the spatial dependence of the dynamics. - """ - - label = "Elastic Incoherent Structure Factor" - - # The category of the analysis. - category = ( - "Analysis", - "Scattering", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["q_vectors"] = ( - "QVectorsConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["projection"] = ( - "ProjectionConfigurator", - {"label": "project coordinates"}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["grouping_level"] = ( - "GroupingLevelConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - "atom_transmutation": "atom_transmutation", - } - }, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["weights"] = ( - "WeightsConfigurator", - { - "default": "b_incoherent", - "dependencies": {"atom_selection": "atom_selection"}, - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] - - self._nQShells = self.configuration["q_vectors"]["n_shells"] - - self._nFrames = self.configuration["frames"]["number"] - - self._outputData.add( - "q", - "LineOutputVariable", - self.configuration["q_vectors"]["shells"], - units="1/nm", - ) - - for element in self.configuration["atom_selection"]["unique_names"]: - self._outputData.add( - "eisf_%s" % element, - "LineOutputVariable", - (self._nQShells,), - axis="q", - units="au", - ) - - self._outputData.add( - "eisf_total", "LineOutputVariable", (self._nQShells,), axis="q", units="au" - ) - - self._atoms = sorted_atoms( - self.configuration["trajectory"]["instance"].chemical_system.atom_list - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. atomicEISF (np.array): The atomic elastic incoherent structure factor - """ - - # get atom index - indexes = self.configuration["atom_selection"]["indexes"][index] - atoms = [self._atoms[idx] for idx in indexes] - - series = self.configuration["trajectory"]["instance"].read_com_trajectory( - atoms, - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - series = self.configuration["projection"]["projector"](series) - - atomicEISF = np.zeros((self._nQShells,), dtype=np.float64) - - for i, q in enumerate(self.configuration["q_vectors"]["shells"]): - if not q in self.configuration["q_vectors"]["value"]: - continue - - qVectors = self.configuration["q_vectors"]["value"][q]["q_vectors"] - - a = np.average(np.exp(1j * np.dot(series, qVectors)), axis=0) - a = np.abs(a) ** 2 - - atomicEISF[i] = np.average(a) - - return index, atomicEISF - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - # The symbol of the atom. - element = self.configuration["atom_selection"]["names"][index] - - self._outputData["eisf_%s" % element] += x - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...) - """ - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for element, number in list(nAtomsPerElement.items()): - self._outputData["eisf_%s" % element][:] /= number - - weights = self.configuration["weights"].get_weights() - self._outputData["eisf_total"][:] = weight( - weights, self._outputData, nAtomsPerElement, 1, "eisf_%s" - ) - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Arithmetic import weight +from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms + + +class ElasticIncoherentStructureFactor(IJob): + """ + The Elastic Incoherent Structure Factor (EISF ) is defined as the limit of the incoherent + intermediate scattering function for infinite time. + + The EISF appears as the incoherent amplitude of the elastic line in the neutron scattering spectrum. + Elastic scattering is only present for systems in which the atomic motion is confined in space, as + in solids. The Q-dependence of the EISF indicates e.g. the fraction of static/mobile atoms and the spatial dependence of the dynamics. + """ + + label = "Elastic Incoherent Structure Factor" + + # The category of the analysis. + category = ( + "Analysis", + "Scattering", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["q_vectors"] = ( + "QVectorsConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["projection"] = ( + "ProjectionConfigurator", + {"label": "project coordinates"}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["grouping_level"] = ( + "GroupingLevelConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + "atom_transmutation": "atom_transmutation", + } + }, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["weights"] = ( + "WeightsConfigurator", + { + "default": "b_incoherent", + "dependencies": {"atom_selection": "atom_selection"}, + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] + + self._nQShells = self.configuration["q_vectors"]["n_shells"] + + self._nFrames = self.configuration["frames"]["number"] + + self._outputData.add( + "q", + "LineOutputVariable", + self.configuration["q_vectors"]["shells"], + units="1/nm", + ) + + for element in self.configuration["atom_selection"]["unique_names"]: + self._outputData.add( + "eisf_%s" % element, + "LineOutputVariable", + (self._nQShells,), + axis="q", + units="au", + ) + + self._outputData.add( + "eisf_total", "LineOutputVariable", (self._nQShells,), axis="q", units="au" + ) + + self._atoms = sorted_atoms( + self.configuration["trajectory"]["instance"].chemical_system.atom_list + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. atomicEISF (np.array): The atomic elastic incoherent structure factor + """ + + # get atom index + indexes = self.configuration["atom_selection"]["indexes"][index] + atoms = [self._atoms[idx] for idx in indexes] + + series = self.configuration["trajectory"]["instance"].read_com_trajectory( + atoms, + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + series = self.configuration["projection"]["projector"](series) + + atomicEISF = np.zeros((self._nQShells,), dtype=np.float64) + + for i, q in enumerate(self.configuration["q_vectors"]["shells"]): + if not q in self.configuration["q_vectors"]["value"]: + continue + + qVectors = self.configuration["q_vectors"]["value"][q]["q_vectors"] + + a = np.average(np.exp(1j * np.dot(series, qVectors)), axis=0) + a = np.abs(a) ** 2 + + atomicEISF[i] = np.average(a) + + return index, atomicEISF + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + # The symbol of the atom. + element = self.configuration["atom_selection"]["names"][index] + + self._outputData["eisf_%s" % element] += x + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...) + """ + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for element, number in list(nAtomsPerElement.items()): + self._outputData["eisf_%s" % element][:] /= number + + weights = self.configuration["weights"].get_weights() + self._outputData["eisf_total"][:] = weight( + weights, self._outputData, nAtomsPerElement, 1, "eisf_%s" + ) + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py index 918c40bf3a..b790774f38 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py -# @brief Implements module/class/test GaussianDynamicIncoherentStructureFactor +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py index d0998746ed..4dd775acaf 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/GeneralAutoCorrelationFunction.py -# @brief Implements module/class/test GeneralAutoCorrelationFunction +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py index a0d95ba5c7..a1cf52df68 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py @@ -1,209 +1,213 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/GlobalMotionFilteredTrajectory.py -# @brief Implements module/class/test GlobalMotionFilteredTrajectory -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import copy - -import numpy as np - -import h5py - -from MDANSE.Chemistry.ChemicalEntity import AtomGroup -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.MolecularDynamics.Configuration import RealConfiguration -from MDANSE.MolecularDynamics.Trajectory import sorted_atoms, TrajectoryWriter - - -class GlobalMotionFilteredTrajectory(IJob): - """ - It is often of interest to separate global translation and rotation motion from internal motion, both for quantitative analysis - and for visualization by animated display. Obviously, this can only be done under the hypothesis that global and internal motions - are decoupled within the length and timescales of the analysis. MDANSE creates a Global Motion Filtered Trajectory (GMFT) by - filtering out global motions (made of the three translational and three rotational degrees of freedom), either on the whole system - or on an user-defined subset, by fitting it to a reference structure (usually the first frame of the MD). Global motion filtering - uses a straightforward algorithm: - - #. for the first frame, find the linear transformation such that the coordinate origin becomes the centre of mass of the system - and its principal axes of inertia are parallel to the three coordinates axes (also called principal axes transformation), - #. this provides a reference configuration *r* - #. for any other frames *f*, find and apply the linear transformation that minimizes the RMS 'distance' between frame *f* and *r*. - - The result is stored in a new trajectory file that contains only internal motions. This analysis can be useful in case where - overall diffusive motions are not of interest e.g. for a protein in solution and the internal protein dynamics fall within the - dynamical range of the instrument. - - In the global motion filtered trajectory, the universe is made infinite and all the configurations contiguous. - """ - - enabled = False - - label = "Global Motion Filtered Trajectory" - - category = ( - "Analysis", - "Trajectory", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["reference_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["output_file"] = ( - "OutputTrajectoryConfigurator", - {"format": "MDTFormat"}, - ) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["frames"]["number"] - - # The collection of atoms corresponding to the atoms selected for output. - atoms = sorted_atoms( - self.configuration["trajectory"]["instance"].chemical_system.atom_list - ) - self._selected_atoms = [] - for indexes in self.configuration["atom_selection"]["indexes"]: - for idx in indexes: - self._selected_atoms.append(atoms[idx]) - self._selected_atoms = AtomGroup(self._selected_atoms) - - self._reference_atoms = [] - for indexes in self.configuration["reference_selection"]["indexes"]: - for idx in indexes: - self._reference_atoms.append(atoms[idx]) - self._reference_atoms = AtomGroup(self._reference_atoms) - - self._output_trajectory = TrajectoryWriter( - self.configuration["output_file"]["file"], - self.configuration["trajectory"]["instance"].chemical_system, - self.numberOfSteps, - self._selected_atoms.atom_list, - positions_dtype=self.configuration["output_file"]["dtype"], - compression=self.configuration["output_file"]["compression"], - ) - - # This will store the configuration used as the reference for the following step. - self._reference_configuration = None - - self._rms = [] - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. None - """ - - # get the Frame index - frameIndex = self.configuration["frames"]["value"][index] - - trajectory = self.configuration["trajectory"]["instance"] - - current_configuration = trajectory.configuration(frameIndex) - current_configuration = current_configuration.continuous_configuration() - variables = copy.deepcopy(current_configuration.variables) - coords = variables.pop("coordinates") - current_configuration = RealConfiguration( - trajectory.chemical_system, coords, **variables - ) - - trajectory.chemical_system.configuration = current_configuration - - # Case of the first frame. - if frameIndex == self.configuration["frames"]["first"]: - # A a linear transformation that shifts the center of mass of the reference atoms to the coordinate origin - # and makes its principal axes of inertia parallel to the three coordinate axes is computed. - transfo = self._reference_atoms.normalizing_transformation( - current_configuration - ) - - # The first rms is set to zero by construction. - rms = 0.0 - - # Case of the other frames. - else: - # The linear transformation that minimizes the RMS distance between the current configuration and the previous - # one is applied to the reference atoms. - transfo, rms = self._reference_atoms.find_transformation( - current_configuration, self._reference_configuration - ) - - # And applied to the selected atoms for output. - current_configuration.apply_transformation(transfo) - - # The current configuration becomes now the reference configuration for the next step. - self._reference_configuration = current_configuration - - variables = copy.deepcopy(current_configuration.variables) - coords = variables.pop("coordinates") - new_configuration = RealConfiguration( - self._output_trajectory.chemical_system, coords, None, **variables - ) - self._output_trajectory.chemical_system.configuration = new_configuration - - # The times corresponding to the running index. - time = self.configuration["frames"]["time"][index] - - # Write the step. - self._output_trajectory.dump_configuration( - time, units={"time": "ps", "unit_cell": "nm", "coordinates": "nm"} - ) - - return index, rms - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - self._rms.append(x) - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - # The input trajectory is closed. - self.configuration["trajectory"]["instance"].close() - - # The output trajectory is closed. - self._output_trajectory.close() - - outputFile = h5py.File(self.configuration["output_file"]["file"], "r+") - - outputFile.create_dataset("rms", data=self._rms, dtype=np.float64) - - outputFile.close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import copy + +import numpy as np + +import h5py + +from MDANSE.Chemistry.ChemicalEntity import AtomGroup +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.MolecularDynamics.Configuration import RealConfiguration +from MDANSE.MolecularDynamics.Trajectory import sorted_atoms, TrajectoryWriter + + +class GlobalMotionFilteredTrajectory(IJob): + """ + It is often of interest to separate global translation and rotation motion from internal motion, both for quantitative analysis + and for visualization by animated display. Obviously, this can only be done under the hypothesis that global and internal motions + are decoupled within the length and timescales of the analysis. MDANSE creates a Global Motion Filtered Trajectory (GMFT) by + filtering out global motions (made of the three translational and three rotational degrees of freedom), either on the whole system + or on an user-defined subset, by fitting it to a reference structure (usually the first frame of the MD). Global motion filtering + uses a straightforward algorithm: + + #. for the first frame, find the linear transformation such that the coordinate origin becomes the centre of mass of the system + and its principal axes of inertia are parallel to the three coordinates axes (also called principal axes transformation), + #. this provides a reference configuration *r* + #. for any other frames *f*, find and apply the linear transformation that minimizes the RMS 'distance' between frame *f* and *r*. + + The result is stored in a new trajectory file that contains only internal motions. This analysis can be useful in case where + overall diffusive motions are not of interest e.g. for a protein in solution and the internal protein dynamics fall within the + dynamical range of the instrument. + + In the global motion filtered trajectory, the universe is made infinite and all the configurations contiguous. + """ + + enabled = False + + label = "Global Motion Filtered Trajectory" + + category = ( + "Analysis", + "Trajectory", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["reference_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["output_file"] = ( + "OutputTrajectoryConfigurator", + {"format": "MDTFormat"}, + ) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["frames"]["number"] + + # The collection of atoms corresponding to the atoms selected for output. + atoms = sorted_atoms( + self.configuration["trajectory"]["instance"].chemical_system.atom_list + ) + self._selected_atoms = [] + for indexes in self.configuration["atom_selection"]["indexes"]: + for idx in indexes: + self._selected_atoms.append(atoms[idx]) + self._selected_atoms = AtomGroup(self._selected_atoms) + + self._reference_atoms = [] + for indexes in self.configuration["reference_selection"]["indexes"]: + for idx in indexes: + self._reference_atoms.append(atoms[idx]) + self._reference_atoms = AtomGroup(self._reference_atoms) + + self._output_trajectory = TrajectoryWriter( + self.configuration["output_file"]["file"], + self.configuration["trajectory"]["instance"].chemical_system, + self.numberOfSteps, + self._selected_atoms.atom_list, + positions_dtype=self.configuration["output_file"]["dtype"], + compression=self.configuration["output_file"]["compression"], + ) + + # This will store the configuration used as the reference for the following step. + self._reference_configuration = None + + self._rms = [] + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. None + """ + + # get the Frame index + frameIndex = self.configuration["frames"]["value"][index] + + trajectory = self.configuration["trajectory"]["instance"] + + current_configuration = trajectory.configuration(frameIndex) + current_configuration = current_configuration.continuous_configuration() + variables = copy.deepcopy(current_configuration.variables) + coords = variables.pop("coordinates") + current_configuration = RealConfiguration( + trajectory.chemical_system, coords, **variables + ) + + trajectory.chemical_system.configuration = current_configuration + + # Case of the first frame. + if frameIndex == self.configuration["frames"]["first"]: + # A a linear transformation that shifts the center of mass of the reference atoms to the coordinate origin + # and makes its principal axes of inertia parallel to the three coordinate axes is computed. + transfo = self._reference_atoms.normalizing_transformation( + current_configuration + ) + + # The first rms is set to zero by construction. + rms = 0.0 + + # Case of the other frames. + else: + # The linear transformation that minimizes the RMS distance between the current configuration and the previous + # one is applied to the reference atoms. + transfo, rms = self._reference_atoms.find_transformation( + current_configuration, self._reference_configuration + ) + + # And applied to the selected atoms for output. + current_configuration.apply_transformation(transfo) + + # The current configuration becomes now the reference configuration for the next step. + self._reference_configuration = current_configuration + + variables = copy.deepcopy(current_configuration.variables) + coords = variables.pop("coordinates") + new_configuration = RealConfiguration( + self._output_trajectory.chemical_system, coords, None, **variables + ) + self._output_trajectory.chemical_system.configuration = new_configuration + + # The times corresponding to the running index. + time = self.configuration["frames"]["time"][index] + + # Write the step. + self._output_trajectory.dump_configuration( + time, units={"time": "ps", "unit_cell": "nm", "coordinates": "nm"} + ) + + return index, rms + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + self._rms.append(x) + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + # The input trajectory is closed. + self.configuration["trajectory"]["instance"].close() + + # The output trajectory is closed. + self._output_trajectory.close() + + outputFile = h5py.File(self.configuration["output_file"]["file"], "r+") + + outputFile.create_dataset("rms", data=self._rms, dtype=np.float64) + + outputFile.close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py b/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py index 43ab7b32b4..bff328fbda 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/IJob.py -# @brief Implements module/class/test IJob +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc import glob diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py b/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py index 8299a303ce..1ac9193dec 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/JobStatus.py -# @brief Implements module/class/test JobStatus +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import pickle diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py b/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py index c773cb9ca5..373d5af48d 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py @@ -1,542 +1,546 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/McStasVirtualInstrument.py -# @brief Implements module/class/test McStasVirtualInstrument -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import os -import shutil -import subprocess -import tempfile -import sys -import io - -import numpy as np - - -from MDANSE.Chemistry import ATOMS_DATABASE -from MDANSE.Core.Error import Error -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable -from MDANSE.Framework.Units import measure -from MDANSE.MolecularDynamics.Trajectory import sorted_atoms -from MDANSE.MolecularDynamics.UnitCell import UnitCell - -MCSTAS_UNITS_LUT = { - "rad/ps": measure(1, "rad/ps", equivalent=True).toval("meV"), - "nm2/ps": measure(1, "nm2/ps", equivalent=True).toval("b/ps"), - "nm2": measure(1, "nm2").toval("b"), - "1/nm": measure(1, "1/nm").toval("1/ang"), -} - -NAVOGADRO = 6.02214129e23 - - -class McStasError(Error): - pass - - -class McStasVirtualInstrument(IJob): - """ - Performs a virtual neutron scattering experiment using a binding to the McStas, neutron ray-tracing code. - - This analysis requires the coherent and incoherent dynamic structure factors to have been calculated - and an instrument to be chosen. - The result is the instrument-dependent perturbation of the sum of the scattering contributions including - instrument resolution, self-shielding and multiple scattering. - """ - - enabled = False - - label = "McStas Virtual Instrument" - - category = ( - "Analysis", - "Virtual Instruments", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["sample_coh"] = ( - "HDFInputFileConfigurator", - { - "widget": "InputFileConfigurator", - "label": "MDANSE Coherent Structure Factor", - "variables": ["q", "omega", "s(q,f)_total"], - "default": "dcsf_prot.h5", - }, - ) - settings["sample_inc"] = ( - "HDFInputFileConfigurator", - { - "widget": "InputFileConfigurator", - "label": "MDANSE Incoherent Structure Factor", - "variables": ["q", "omega", "s(q,f)_total"], - "default": "disf_prot.h5", - }, - ) - settings["temperature"] = ( - "FloatConfigurator", - { - "default": 298.0, - "label": "The sample temperature to be used in the simulation.", - }, - ) - settings["display"] = ( - "BooleanConfigurator", - {"label": "trace the 3D view of the simulation"}, - ) - settings["instrument"] = ( - "McStasInstrumentConfigurator", - {"label": "mcstas instrument", "default": "OUTPUT_FILENAME.out"}, - ) - settings["options"] = ("McStasOptionsConfigurator", {"label": "mcstas options"}) - settings["parameters"] = ( - "McStasParametersConfigurator", - { - "label": "instrument parameters", - "dependencies": {"instrument": "instrument"}, - "exclude": ["sample_coh", "sample_inc"], - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - # The number of steps is set to 1 as the job is defined as single McStas run. - self.numberOfSteps = 1 - - symbols = sorted_atoms( - self.configuration["trajectory"]["instance"]._chemical_system.atom_list, - "symbol", - ) - - # Compute some parameters used for a proper McStas run - self._mcStasPhysicalParameters = {"density": 0.0} - self._mcStasPhysicalParameters["V_rho"] = 0.0 - self._mcStasPhysicalParameters["weight"] = sum( - [ATOMS_DATABASE.get_atom_property(s, "atomic_weight") for s in symbols] - ) - self._mcStasPhysicalParameters["sigma_abs"] = ( - np.mean( - [ATOMS_DATABASE.get_atom_property(s, "xs_absorption") for s in symbols] - ) - * MCSTAS_UNITS_LUT["nm2"] - ) - self._mcStasPhysicalParameters["sigma_coh"] = ( - np.mean( - [ATOMS_DATABASE.get_atom_property(s, "xs_coherent") for s in symbols] - ) - * MCSTAS_UNITS_LUT["nm2"] - ) - self._mcStasPhysicalParameters["sigma_inc"] = ( - np.mean( - [ATOMS_DATABASE.get_atom_property(s, "xs_incoherent") for s in symbols] - ) - * MCSTAS_UNITS_LUT["nm2"] - ) - for frameIndex in self.configuration["frames"]["value"]: - configuration = self.configuration["trajectory"]["instance"].configuration( - frameIndex - ) - cellVolume = configuration._unit_cell.volume - self._mcStasPhysicalParameters["density"] += ( - self._mcStasPhysicalParameters["weight"] / cellVolume - ) - self._mcStasPhysicalParameters["V_rho"] += ( - configuration._chemical_system.number_of_atoms / cellVolume - ) - self._mcStasPhysicalParameters["density"] /= self.configuration["frames"][ - "n_frames" - ] - self._mcStasPhysicalParameters["V_rho"] /= self.configuration["frames"][ - "n_frames" - ] - # The density is converty in g/cm3 - self._mcStasPhysicalParameters["density"] /= NAVOGADRO / measure( - 1.0, "cm3" - ).toval("nm3") - self._mcStasPhysicalParameters["V_rho"] *= measure(1.0, "1/nm3").toval("1/ang3") - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - """ - - sqw = ["sample_coh", "sample_inc"] - sqwInput = "" - self.outFile = {} - for typ in sqw: - fout = tempfile.NamedTemporaryFile(mode="w", delete=False) - # for debugging, we use a real file here: - # fout = open( - # "/Users/maciej.bartkowiak/an_example/mcstas/Persistent_file_for_" - # + typ - # + ".sqw", - # "w", - # ) - - fout.write("# Physical parameters:\n") - for k, v in list(self._mcStasPhysicalParameters.items()): - fout.write("# %s %s \n" % (k, v)) - - fout.write( - "# Temperature %s \n" % self.configuration["temperature"]["value"] - ) - fout.write("#\n") - - for var in self.configuration[typ].variables: - fout.write("# %s\n" % var) - - data = self.configuration[typ][var][:] - print(f"In {typ} the variable {var} has shape {data.shape}") - print(f"Values of {var}: min={data.min()}, max = {data.max()}") - data_unit = self.configuration[typ]._units[var] - try: - data *= MCSTAS_UNITS_LUT[data_unit] - except KeyError: - print( - f"Could not find the physical unit {data_unit} in the lookup table." - ) - - np.savetxt(fout, np.atleast_2d(data), delimiter=" ", newline="\n") - - fout.close() - self.outFile[typ] = fout.name - # self.outFile[typ] = ( - # "/Users/maciej.bartkowiak/an_example/mcstas/Persistent_file_for_" - # + typ - # + ".sqw" - # ) - sqwInput += "%s=%s " % (typ, fout.name) - - # sys.exit(0) - - trace = "" - if self.configuration["display"]["value"]: - trace = " --trace " - execPath = self.configuration["instrument"]["value"] - options = self.configuration["options"]["value"] - parameters = self.configuration["parameters"]["value"] - - cmdLine = [execPath] - cmdLine.extend(options) - cmdLine.append(sqwInput) - cmdLine.append(trace) - cmdLine.extend(parameters) - - print(" ".join(cmdLine)) - - s = subprocess.Popen( - " ".join(cmdLine), - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - shell=True, - ) - out, _ = s.communicate() - - for line in out.splitlines(): - if "ERROR" in line.decode(encoding="utf-8"): - raise McStasError("An error occured during McStas run: %s" % out) - - with open( - os.path.join( - self.configuration["options"]["mcstas_output_directory"], - "mcstas_mdanse.mvi", - ), - "w", - ) as f: - f.write(out.decode(encoding="utf-8")) - - return index, None - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - pass - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - # Rename and move to the result dir the SQW file input - for typ, fname in list(self.outFile.items()): - shutil.move( - fname, - os.path.join( - self.configuration["options"]["mcstas_output_directory"], - typ + ".sqw", - ), - ) - - # Convert McStas output files into NetCDF format - self.convert(self.configuration["options"]["mcstas_output_directory"]) - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - def treat_str_var(self, s): - return s.strip().replace(" ", "_") - - def unique(self, key, d, value=None): - skey = key - i = 0 - if value is not None: - for k, v in list(d.items()): - if v.shape != value.shape: - continue - if np.allclose(v, value): - return k - while key in d: - key = skey + "_%d" % i - i += 1 - return key - - def convert(self, sim_dir): - """ - Convert McStas data set to netCDF File Format - """ - - typique_sim_fnames = ["mccode.sim", "mcstas.sim"] - sim_file = "" - for sim_fname in typique_sim_fnames: - sim_file = os.path.join(sim_dir, sim_fname) - if os.path.isfile(sim_file): - break - - if not sim_file: - raise Exception("Dataset " + sim_file + " does not exist!") - - isBegin = lambda line: line.strip().startswith("begin") - isCompFilename = lambda line: line.strip().startswith("filename:") - # First, determine if this is single or overview plot... - SimFile = list(filter(isBegin, open(sim_file).readlines())) - Datfile = 0 - if SimFile == []: - FS = self.read_monitor(sim_file) - typ = FS["type"].split("(")[0].strip() - if typ != "multiarray_1d": - FS = self.save_single(FS) - exit() - Datfile = 1 - - # Get filenames from the sim file - MonFiles = list(filter(isCompFilename, open(sim_file).readlines())) - L = len(MonFiles) - FSlist = [] - # Scan or overview? - if L == 0: - """Scan view""" - if Datfile == 0: - isFilename = lambda line: line.strip().startswith("filename") - - Scanfile = list(filter(isFilename, open(sim_file).readlines())) - Scanfile = Scanfile[0].split(": ") - Scanfile = os.path.join(sim_dir, Scanfile[1].strip()) - # Proceed to load scan datafile - FS = self.read_monitor(Scanfile) - L = (len(FS["variables"].split()) - 1) / 2 - self.scan_flag = 1 - for j in range(0, L): - FSsingle = self.get_monitor(FS, j) - FSlist[len(FSlist) :] = [FSsingle] - FSlist[j] = self.save_single(FSsingle) - self.scan_length = FSsingle["data"].shape[0] - else: - """Overview or single monitor""" - for j in range(0, L): - MonFile = MonFiles[j].split(":") - MonFile = MonFile[1].strip() - MonFile = os.path.join(sim_dir, MonFile) - FS = self.read_monitor(MonFile) - FSlist[len(FSlist) :] = [FS] - FSlist[j] = self.save_single(FS) - - def save_single(self, FileStruct): - """ - save a single 1D/2D data array with axis into a NetCDF file format. - input: FileStruct as obtained from read_monitor() - output: FileStruct data structure - """ - - typ = FileStruct["type"].split("(")[0].strip() - - if typ == "array_1d": - # 1D data set - Xmin = eval(FileStruct["xlimits"].split()[0]) - Xmax = eval(FileStruct["xlimits"].split()[1]) - x = FileStruct["data"][:, 0] - y = FileStruct["data"][:, 1] - - Title = self.unique( - self.treat_str_var(FileStruct["component"]), self._outputData - ) - xlabel = self.unique( - self.treat_str_var(FileStruct["xlabel"]), self._outputData, x - ) - - self._outputData[xlabel] = IOutputVariable.create( - "LineOutputVariable", x, xlabel, units="au" - ) - self._outputData[Title] = IOutputVariable.create( - "LineOutputVariable", y, Title, axis="%s" % xlabel, units="au" - ) - - elif typ == "array_2d": - # 2D data set - mysize = FileStruct["data"].shape - - I = FileStruct["data"] - mysize = I.shape - I = I.T - - Xmin = eval(FileStruct["xylimits"].split()[0]) - Xmax = eval(FileStruct["xylimits"].split()[1]) - Ymin = eval(FileStruct["xylimits"].split()[2]) - Ymax = eval(FileStruct["xylimits"].split()[3]) - - x = np.linspace(Xmin, Xmax, mysize[1]) - y = np.linspace(Ymin, Ymax, mysize[0]) - - title = self.unique( - self.treat_str_var(FileStruct["component"]), self._outputData - ) - xlabel = self.unique( - self.treat_str_var(FileStruct["xlabel"]), self._outputData, x - ) - ylabel = self.unique( - self.treat_str_var(FileStruct["ylabel"]), self._outputData, y - ) - - self._outputData.add(xlabel, "LineOutputVariable", x, units="au") - self._outputData.add(ylabel, "LineOutputVariable", y, units="au") - self._outputData.add( - title, - "SurfaceOutputVariable", - I, - axis="%s|%s" % (xlabel, ylabel), - units="au", - ) - - return FileStruct - - def read_monitor(self, simFile): - """ - Read a monitor file (McCode format). - - :param simFile: the path for the monitor file. - :type simFile: str - - :return: a dictionary built from the evaluation of McStas monitor file header that will contains the data and metadata about the monitor. - :rtype: dict - """ - - # Read header - isHeader = lambda line: line.startswith("#") - f = open(simFile) - Lines = f.readlines() - Header = list(filter(isHeader, Lines)) - f.close() - - # Traverse header and define corresponding 'struct' - strStruct = "{" - for j in range(0, len(Header)): - # Field name and data - Line = Header[j] - Line = Line[2 : len(Line)].strip() - Line = Line.split(":") - Field = Line[0] - Value = "" - Value = "".join(":".join(Line[1 : len(Line)]).split("'")) - strStruct = strStruct + "'" + Field + "':'" + Value + "'" - if j < len(Header) - 1: - strStruct += "," - strStruct = strStruct + "}" - Filestruct = eval(strStruct) - # Add the data block - - data = [] - f = open(simFile, "r") - lines = f.readlines() - f.close() - - header = True - for l in lines: - if l.startswith("#"): - if header: - continue - else: - break - else: - if header: - header = False - data.append(l) - - Filestruct["data"] = np.genfromtxt(io.StringIO(" ".join(data))) - Filestruct["fullpath"] = simFile - - return Filestruct - - def get_monitor(self, monitor, col): - """ - Extract one of the monitor in scan steps called from: display - - :param monitor: the dictionary that contains data and metadata about the monitor (obtained from `read_monitor`) - :type monitor: dict - :param col: index of the monitor column to extract. - :type col: int - :return: a dictionary that contains data and metadata about monitor `j`. - :rtype: dict - """ - - # Ugly, hard-coded... - data = monitor["data"][:, (0, 2 * col + 1, 2 * col + 2)] - variables = monitor["variables"].split() - FSsingle = { - "xlimits": monitor["xlimits"], - "data": data, - "component": variables[col + 1], - "values": "", - "type": "array_1d(100)", - "xlabel": monitor["xlabel"], - "ylabel": monitor["ylabel"], - "File": "Scan", - "title": "", - } - - return FSsingle +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import os +import shutil +import subprocess +import tempfile +import sys +import io + +import numpy as np + + +from MDANSE.Chemistry import ATOMS_DATABASE +from MDANSE.Core.Error import Error +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable +from MDANSE.Framework.Units import measure +from MDANSE.MolecularDynamics.Trajectory import sorted_atoms +from MDANSE.MolecularDynamics.UnitCell import UnitCell + +MCSTAS_UNITS_LUT = { + "rad/ps": measure(1, "rad/ps", equivalent=True).toval("meV"), + "nm2/ps": measure(1, "nm2/ps", equivalent=True).toval("b/ps"), + "nm2": measure(1, "nm2").toval("b"), + "1/nm": measure(1, "1/nm").toval("1/ang"), +} + +NAVOGADRO = 6.02214129e23 + + +class McStasError(Error): + pass + + +class McStasVirtualInstrument(IJob): + """ + Performs a virtual neutron scattering experiment using a binding to the McStas, neutron ray-tracing code. + + This analysis requires the coherent and incoherent dynamic structure factors to have been calculated + and an instrument to be chosen. + The result is the instrument-dependent perturbation of the sum of the scattering contributions including + instrument resolution, self-shielding and multiple scattering. + """ + + enabled = False + + label = "McStas Virtual Instrument" + + category = ( + "Analysis", + "Virtual Instruments", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["sample_coh"] = ( + "HDFInputFileConfigurator", + { + "widget": "InputFileConfigurator", + "label": "MDANSE Coherent Structure Factor", + "variables": ["q", "omega", "s(q,f)_total"], + "default": "dcsf_prot.h5", + }, + ) + settings["sample_inc"] = ( + "HDFInputFileConfigurator", + { + "widget": "InputFileConfigurator", + "label": "MDANSE Incoherent Structure Factor", + "variables": ["q", "omega", "s(q,f)_total"], + "default": "disf_prot.h5", + }, + ) + settings["temperature"] = ( + "FloatConfigurator", + { + "default": 298.0, + "label": "The sample temperature to be used in the simulation.", + }, + ) + settings["display"] = ( + "BooleanConfigurator", + {"label": "trace the 3D view of the simulation"}, + ) + settings["instrument"] = ( + "McStasInstrumentConfigurator", + {"label": "mcstas instrument", "default": "OUTPUT_FILENAME.out"}, + ) + settings["options"] = ("McStasOptionsConfigurator", {"label": "mcstas options"}) + settings["parameters"] = ( + "McStasParametersConfigurator", + { + "label": "instrument parameters", + "dependencies": {"instrument": "instrument"}, + "exclude": ["sample_coh", "sample_inc"], + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + # The number of steps is set to 1 as the job is defined as single McStas run. + self.numberOfSteps = 1 + + symbols = sorted_atoms( + self.configuration["trajectory"]["instance"]._chemical_system.atom_list, + "symbol", + ) + + # Compute some parameters used for a proper McStas run + self._mcStasPhysicalParameters = {"density": 0.0} + self._mcStasPhysicalParameters["V_rho"] = 0.0 + self._mcStasPhysicalParameters["weight"] = sum( + [ATOMS_DATABASE.get_atom_property(s, "atomic_weight") for s in symbols] + ) + self._mcStasPhysicalParameters["sigma_abs"] = ( + np.mean( + [ATOMS_DATABASE.get_atom_property(s, "xs_absorption") for s in symbols] + ) + * MCSTAS_UNITS_LUT["nm2"] + ) + self._mcStasPhysicalParameters["sigma_coh"] = ( + np.mean( + [ATOMS_DATABASE.get_atom_property(s, "xs_coherent") for s in symbols] + ) + * MCSTAS_UNITS_LUT["nm2"] + ) + self._mcStasPhysicalParameters["sigma_inc"] = ( + np.mean( + [ATOMS_DATABASE.get_atom_property(s, "xs_incoherent") for s in symbols] + ) + * MCSTAS_UNITS_LUT["nm2"] + ) + for frameIndex in self.configuration["frames"]["value"]: + configuration = self.configuration["trajectory"]["instance"].configuration( + frameIndex + ) + cellVolume = configuration._unit_cell.volume + self._mcStasPhysicalParameters["density"] += ( + self._mcStasPhysicalParameters["weight"] / cellVolume + ) + self._mcStasPhysicalParameters["V_rho"] += ( + configuration._chemical_system.number_of_atoms / cellVolume + ) + self._mcStasPhysicalParameters["density"] /= self.configuration["frames"][ + "n_frames" + ] + self._mcStasPhysicalParameters["V_rho"] /= self.configuration["frames"][ + "n_frames" + ] + # The density is converty in g/cm3 + self._mcStasPhysicalParameters["density"] /= NAVOGADRO / measure( + 1.0, "cm3" + ).toval("nm3") + self._mcStasPhysicalParameters["V_rho"] *= measure(1.0, "1/nm3").toval("1/ang3") + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + """ + + sqw = ["sample_coh", "sample_inc"] + sqwInput = "" + self.outFile = {} + for typ in sqw: + fout = tempfile.NamedTemporaryFile(mode="w", delete=False) + # for debugging, we use a real file here: + # fout = open( + # "/Users/maciej.bartkowiak/an_example/mcstas/Persistent_file_for_" + # + typ + # + ".sqw", + # "w", + # ) + + fout.write("# Physical parameters:\n") + for k, v in list(self._mcStasPhysicalParameters.items()): + fout.write("# %s %s \n" % (k, v)) + + fout.write( + "# Temperature %s \n" % self.configuration["temperature"]["value"] + ) + fout.write("#\n") + + for var in self.configuration[typ].variables: + fout.write("# %s\n" % var) + + data = self.configuration[typ][var][:] + print(f"In {typ} the variable {var} has shape {data.shape}") + print(f"Values of {var}: min={data.min()}, max = {data.max()}") + data_unit = self.configuration[typ]._units[var] + try: + data *= MCSTAS_UNITS_LUT[data_unit] + except KeyError: + print( + f"Could not find the physical unit {data_unit} in the lookup table." + ) + + np.savetxt(fout, np.atleast_2d(data), delimiter=" ", newline="\n") + + fout.close() + self.outFile[typ] = fout.name + # self.outFile[typ] = ( + # "/Users/maciej.bartkowiak/an_example/mcstas/Persistent_file_for_" + # + typ + # + ".sqw" + # ) + sqwInput += "%s=%s " % (typ, fout.name) + + # sys.exit(0) + + trace = "" + if self.configuration["display"]["value"]: + trace = " --trace " + execPath = self.configuration["instrument"]["value"] + options = self.configuration["options"]["value"] + parameters = self.configuration["parameters"]["value"] + + cmdLine = [execPath] + cmdLine.extend(options) + cmdLine.append(sqwInput) + cmdLine.append(trace) + cmdLine.extend(parameters) + + print(" ".join(cmdLine)) + + s = subprocess.Popen( + " ".join(cmdLine), + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + shell=True, + ) + out, _ = s.communicate() + + for line in out.splitlines(): + if "ERROR" in line.decode(encoding="utf-8"): + raise McStasError("An error occured during McStas run: %s" % out) + + with open( + os.path.join( + self.configuration["options"]["mcstas_output_directory"], + "mcstas_mdanse.mvi", + ), + "w", + ) as f: + f.write(out.decode(encoding="utf-8")) + + return index, None + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + pass + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + # Rename and move to the result dir the SQW file input + for typ, fname in list(self.outFile.items()): + shutil.move( + fname, + os.path.join( + self.configuration["options"]["mcstas_output_directory"], + typ + ".sqw", + ), + ) + + # Convert McStas output files into NetCDF format + self.convert(self.configuration["options"]["mcstas_output_directory"]) + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + def treat_str_var(self, s): + return s.strip().replace(" ", "_") + + def unique(self, key, d, value=None): + skey = key + i = 0 + if value is not None: + for k, v in list(d.items()): + if v.shape != value.shape: + continue + if np.allclose(v, value): + return k + while key in d: + key = skey + "_%d" % i + i += 1 + return key + + def convert(self, sim_dir): + """ + Convert McStas data set to netCDF File Format + """ + + typique_sim_fnames = ["mccode.sim", "mcstas.sim"] + sim_file = "" + for sim_fname in typique_sim_fnames: + sim_file = os.path.join(sim_dir, sim_fname) + if os.path.isfile(sim_file): + break + + if not sim_file: + raise Exception("Dataset " + sim_file + " does not exist!") + + isBegin = lambda line: line.strip().startswith("begin") + isCompFilename = lambda line: line.strip().startswith("filename:") + # First, determine if this is single or overview plot... + SimFile = list(filter(isBegin, open(sim_file).readlines())) + Datfile = 0 + if SimFile == []: + FS = self.read_monitor(sim_file) + typ = FS["type"].split("(")[0].strip() + if typ != "multiarray_1d": + FS = self.save_single(FS) + exit() + Datfile = 1 + + # Get filenames from the sim file + MonFiles = list(filter(isCompFilename, open(sim_file).readlines())) + L = len(MonFiles) + FSlist = [] + # Scan or overview? + if L == 0: + """Scan view""" + if Datfile == 0: + isFilename = lambda line: line.strip().startswith("filename") + + Scanfile = list(filter(isFilename, open(sim_file).readlines())) + Scanfile = Scanfile[0].split(": ") + Scanfile = os.path.join(sim_dir, Scanfile[1].strip()) + # Proceed to load scan datafile + FS = self.read_monitor(Scanfile) + L = (len(FS["variables"].split()) - 1) / 2 + self.scan_flag = 1 + for j in range(0, L): + FSsingle = self.get_monitor(FS, j) + FSlist[len(FSlist) :] = [FSsingle] + FSlist[j] = self.save_single(FSsingle) + self.scan_length = FSsingle["data"].shape[0] + else: + """Overview or single monitor""" + for j in range(0, L): + MonFile = MonFiles[j].split(":") + MonFile = MonFile[1].strip() + MonFile = os.path.join(sim_dir, MonFile) + FS = self.read_monitor(MonFile) + FSlist[len(FSlist) :] = [FS] + FSlist[j] = self.save_single(FS) + + def save_single(self, FileStruct): + """ + save a single 1D/2D data array with axis into a NetCDF file format. + input: FileStruct as obtained from read_monitor() + output: FileStruct data structure + """ + + typ = FileStruct["type"].split("(")[0].strip() + + if typ == "array_1d": + # 1D data set + Xmin = eval(FileStruct["xlimits"].split()[0]) + Xmax = eval(FileStruct["xlimits"].split()[1]) + x = FileStruct["data"][:, 0] + y = FileStruct["data"][:, 1] + + Title = self.unique( + self.treat_str_var(FileStruct["component"]), self._outputData + ) + xlabel = self.unique( + self.treat_str_var(FileStruct["xlabel"]), self._outputData, x + ) + + self._outputData[xlabel] = IOutputVariable.create( + "LineOutputVariable", x, xlabel, units="au" + ) + self._outputData[Title] = IOutputVariable.create( + "LineOutputVariable", y, Title, axis="%s" % xlabel, units="au" + ) + + elif typ == "array_2d": + # 2D data set + mysize = FileStruct["data"].shape + + I = FileStruct["data"] + mysize = I.shape + I = I.T + + Xmin = eval(FileStruct["xylimits"].split()[0]) + Xmax = eval(FileStruct["xylimits"].split()[1]) + Ymin = eval(FileStruct["xylimits"].split()[2]) + Ymax = eval(FileStruct["xylimits"].split()[3]) + + x = np.linspace(Xmin, Xmax, mysize[1]) + y = np.linspace(Ymin, Ymax, mysize[0]) + + title = self.unique( + self.treat_str_var(FileStruct["component"]), self._outputData + ) + xlabel = self.unique( + self.treat_str_var(FileStruct["xlabel"]), self._outputData, x + ) + ylabel = self.unique( + self.treat_str_var(FileStruct["ylabel"]), self._outputData, y + ) + + self._outputData.add(xlabel, "LineOutputVariable", x, units="au") + self._outputData.add(ylabel, "LineOutputVariable", y, units="au") + self._outputData.add( + title, + "SurfaceOutputVariable", + I, + axis="%s|%s" % (xlabel, ylabel), + units="au", + ) + + return FileStruct + + def read_monitor(self, simFile): + """ + Read a monitor file (McCode format). + + :param simFile: the path for the monitor file. + :type simFile: str + + :return: a dictionary built from the evaluation of McStas monitor file header that will contains the data and metadata about the monitor. + :rtype: dict + """ + + # Read header + isHeader = lambda line: line.startswith("#") + f = open(simFile) + Lines = f.readlines() + Header = list(filter(isHeader, Lines)) + f.close() + + # Traverse header and define corresponding 'struct' + strStruct = "{" + for j in range(0, len(Header)): + # Field name and data + Line = Header[j] + Line = Line[2 : len(Line)].strip() + Line = Line.split(":") + Field = Line[0] + Value = "" + Value = "".join(":".join(Line[1 : len(Line)]).split("'")) + strStruct = strStruct + "'" + Field + "':'" + Value + "'" + if j < len(Header) - 1: + strStruct += "," + strStruct = strStruct + "}" + Filestruct = eval(strStruct) + # Add the data block + + data = [] + f = open(simFile, "r") + lines = f.readlines() + f.close() + + header = True + for l in lines: + if l.startswith("#"): + if header: + continue + else: + break + else: + if header: + header = False + data.append(l) + + Filestruct["data"] = np.genfromtxt(io.StringIO(" ".join(data))) + Filestruct["fullpath"] = simFile + + return Filestruct + + def get_monitor(self, monitor, col): + """ + Extract one of the monitor in scan steps called from: display + + :param monitor: the dictionary that contains data and metadata about the monitor (obtained from `read_monitor`) + :type monitor: dict + :param col: index of the monitor column to extract. + :type col: int + :return: a dictionary that contains data and metadata about monitor `j`. + :rtype: dict + """ + + # Ugly, hard-coded... + data = monitor["data"][:, (0, 2 * col + 1, 2 * col + 2)] + variables = monitor["variables"].split() + FSsingle = { + "xlimits": monitor["xlimits"], + "data": data, + "component": variables[col + 1], + "values": "", + "type": "array_1d(100)", + "xlabel": monitor["xlabel"], + "ylabel": monitor["ylabel"], + "File": "Scan", + "title": "", + } + + return FSsingle diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py b/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py index 1cc85b1e9d..ce9e60fa73 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/MeanSquareDisplacement.py -# @brief Implements module/class/test MeanSquareDisplacement +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py b/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py index b57ecfed60..40711929c6 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/MolecularTrace.py -# @brief Implements module/class/test MolecularTrace +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py b/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py index 7080254517..864a95a28d 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/Temperature.py -# @brief Implements module/class/test Temperature +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py index 4fd797cc4f..053db55c8e 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py @@ -1,456 +1,460 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/NeutronDynamicTotalStructureFactor.py -# @brief Implements module/class/test NeutronDynamicTotalStructureFactor -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import itertools -import os - -import numpy as np - -from MDANSE.Chemistry import ATOMS_DATABASE -from MDANSE.Core.Error import Error -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Signal import correlation, get_spectrum - - -class NeutronDynamicTotalStructureFactorError(Error): - pass - - -class NeutronDynamicTotalStructureFactor(IJob): - """ - Computes the dynamic total structure factor for a set of atoms as the sum of the incoherent and coherent structure factors - """ - - label = "Neutron Dynamic Total Structure Factor" - - category = ( - "Analysis", - "Scattering", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["dcsf_input_file"] = ( - "HDFInputFileConfigurator", - {"label": "MDANSE Coherent Structure Factor", "default": "dcsf.h5"}, - ) - settings["disf_input_file"] = ( - "HDFInputFileConfigurator", - {"label": "MDANSE Incoherent Structure Factor", "default": "disf.h5"}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = 1 - - # Check time consistency - if "time" not in self.configuration["dcsf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No time found in dcsf input file" - ) - if "time" not in self.configuration["disf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No time found in disf input file" - ) - - dcsf_time = self.configuration["dcsf_input_file"]["instance"]["time"][:] - disf_time = self.configuration["disf_input_file"]["instance"]["time"][:] - - if not np.all(dcsf_time == disf_time): - raise NeutronDynamicTotalStructureFactorError( - "Inconsistent times between dcsf and disf input files" - ) - - self._outputData.add("time", "LineOutputVariable", dcsf_time, units="ps") - - # Check time window consistency - if "time_window" not in self.configuration["dcsf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No time window found in dcsf input file" - ) - if "time_window" not in self.configuration["disf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No time window found in disf input file" - ) - - dcsf_time_window = self.configuration["dcsf_input_file"]["instance"][ - "time_window" - ][:] - disf_time_window = self.configuration["disf_input_file"]["instance"][ - "time_window" - ][:] - - if not np.all(dcsf_time_window == disf_time_window): - raise NeutronDynamicTotalStructureFactorError( - "Inconsistent time windows between dcsf and disf input files" - ) - - self._outputData.add( - "time_window", "LineOutputVariable", dcsf_time_window, units="au" - ) - - # Check q values consistency - if "q" not in self.configuration["dcsf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No q values found in dcsf input file" - ) - if "q" not in self.configuration["disf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No q values found in disf input file" - ) - - dcsf_q = self.configuration["dcsf_input_file"]["instance"]["q"][:] - disf_q = self.configuration["disf_input_file"]["instance"]["q"][:] - - if not np.all(dcsf_q == disf_q): - raise NeutronDynamicTotalStructureFactorError( - "Inconsistent q values between dcsf and disf input files" - ) - - self._outputData.add("q", "LineOutputVariable", dcsf_q, units="1/nm") - - # Check omega consistency - if "omega" not in self.configuration["dcsf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No omega found in dcsf input file" - ) - if "omega" not in self.configuration["disf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No omega found in disf input file" - ) - - dcsf_omegas = self.configuration["dcsf_input_file"]["instance"]["omega"][:] - disf_omegas = self.configuration["disf_input_file"]["instance"]["omega"][:] - - if not np.all(dcsf_omegas == disf_omegas): - raise NeutronDynamicTotalStructureFactorError( - "Inconsistent omegas between dcsf and disf input files" - ) - - self._outputData.add("omega", "LineOutputVariable", dcsf_omegas, units="rad/ps") - - # Check omega window consistency - if "omega_window" not in self.configuration["dcsf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No omega window found in dcsf input file" - ) - if "omega_window" not in self.configuration["disf_input_file"]["instance"]: - raise NeutronDynamicTotalStructureFactorError( - "No omega window found in disf input file" - ) - - dcsf_omega_window = self.configuration["dcsf_input_file"]["instance"][ - "omega_window" - ][:] - disf_omega_window = self.configuration["disf_input_file"]["instance"][ - "omega_window" - ][:] - - if not np.all(dcsf_omega_window == disf_omega_window): - raise NeutronDynamicTotalStructureFactorError( - "Inconsistent omega windows between dcsf and disf input files" - ) - - self._outputData.add( - "omega_window", "LineOutputVariable", dcsf_omegas, units="au" - ) - - # Check f(q,t) and s(q,f) for dcsf - self._elementsPairs = sorted( - itertools.combinations_with_replacement( - self.configuration["atom_selection"]["unique_names"], 2 - ) - ) - for pair in self._elementsPairs: - if ( - "f(q,t)_{}{}".format(*pair) - not in self.configuration["dcsf_input_file"]["instance"] - ): - raise NeutronDynamicTotalStructureFactorError( - "Missing f(q,t) in dcsf input file" - ) - if ( - "s(q,f)_{}{}".format(*pair) - not in self.configuration["dcsf_input_file"]["instance"] - ): - raise NeutronDynamicTotalStructureFactorError( - "Missing s(q,f) in dcsf input file" - ) - - for element in self.configuration["atom_selection"]["unique_names"]: - if ( - "f(q,t)_{}".format(element) - not in self.configuration["disf_input_file"]["instance"] - ): - raise NeutronDynamicTotalStructureFactorError( - "Missing f(q,t) in disf input file" - ) - if ( - "s(q,f)_{}".format(element) - not in self.configuration["disf_input_file"]["instance"] - ): - raise NeutronDynamicTotalStructureFactorError( - "Missing s(q,f) in disf input file" - ) - - for element in self.configuration["atom_selection"]["unique_names"]: - fqt = self.configuration["disf_input_file"]["instance"][ - "f(q,t)_{}".format(element) - ] - sqf = self.configuration["disf_input_file"]["instance"][ - "s(q,f)_{}".format(element) - ] - self._outputData.add( - "f(q,t)_inc_%s" % element, - "SurfaceOutputVariable", - fqt, - axis="q|time", - units="au", - ) - self._outputData.add( - "s(q,f)_inc_%s" % element, - "SurfaceOutputVariable", - sqf, - axis="q|omega", - units="nm2/ps", - ) - self._outputData.add( - "f(q,t)_inc_weighted_%s" % element, - "SurfaceOutputVariable", - fqt.shape, - axis="q|time", - units="au", - ) - self._outputData.add( - "s(q,f)_inc_weighted_%s" % element, - "SurfaceOutputVariable", - sqf.shape, - axis="q|omega", - units="nm2/ps", - ) - - for pair in self._elementsPairs: - fqt = self.configuration["dcsf_input_file"]["instance"][ - "f(q,t)_{}{}".format(*pair) - ] - sqf = self.configuration["dcsf_input_file"]["instance"][ - "s(q,f)_{}{}".format(*pair) - ] - self._outputData.add( - "f(q,t)_coh_%s%s" % pair, - "SurfaceOutputVariable", - fqt, - axis="q|time", - units="au", - ) - self._outputData.add( - "s(q,f)_coh_%s%s" % pair, - "SurfaceOutputVariable", - sqf, - axis="q|omega", - units="nm2/ps", - ) - self._outputData.add( - "f(q,t)_coh_weighted_%s%s" % pair, - "SurfaceOutputVariable", - fqt.shape, - axis="q|time", - units="au", - ) - self._outputData.add( - "s(q,f)_coh_weighted_%s%s" % pair, - "SurfaceOutputVariable", - sqf.shape, - axis="q|omega", - units="nm2/ps", - ) - - nQValues = len(dcsf_q) - nTimes = len(dcsf_time) - nOmegas = len(dcsf_omegas) - - self._outputData.add( - "f(q,t)_coh_total", - "SurfaceOutputVariable", - (nQValues, nTimes), - axis="q|time", - units="au", - ) - self._outputData.add( - "f(q,t)_inc_total", - "SurfaceOutputVariable", - (nQValues, nTimes), - axis="q|time", - units="au", - ) - self._outputData.add( - "f(q,t)_total", - "SurfaceOutputVariable", - (nQValues, nTimes), - axis="q|time", - units="au", - ) - - self._outputData.add( - "s(q,f)_coh_total", - "SurfaceOutputVariable", - (nQValues, nOmegas), - axis="q|omega", - units="nm2/ps", - ) - self._outputData.add( - "s(q,f)_inc_total", - "SurfaceOutputVariable", - (nQValues, nOmegas), - axis="q|omega", - units="nm2/ps", - ) - self._outputData.add( - "s(q,f)_total", - "SurfaceOutputVariable", - (nQValues, nOmegas), - axis="q|omega", - units="nm2/ps", - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. rho (np.array): The exponential part of I(k,t) - """ - - return index, None - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...) - """ - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - - # Compute concentrations - nTotalAtoms = 0 - for val in list(nAtomsPerElement.values()): - nTotalAtoms += val - - # Compute coherent functions and structure factor - for pair in self._elementsPairs: - bi = ATOMS_DATABASE.get_atom_property(pair[0], "b_coherent") - bj = ATOMS_DATABASE.get_atom_property(pair[1], "b_coherent") - ni = nAtomsPerElement[pair[0]] - nj = nAtomsPerElement[pair[1]] - ci = ni / nTotalAtoms - cj = nj / nTotalAtoms - - self._outputData["f(q,t)_coh_weighted_%s%s" % pair][:] = ( - self._outputData["f(q,t)_coh_%s%s" % pair][:] - * np.sqrt(ci * cj) - * bi - * bj - ) - self._outputData["s(q,f)_coh_weighted_%s%s" % pair][:] = ( - self._outputData["s(q,f)_coh_%s%s" % pair][:] - * np.sqrt(ci * cj) - * bi - * bj - ) - if pair[0] == pair[1]: # Add a factor 2 if the two elements are different - self._outputData["f(q,t)_coh_total"][:] += self._outputData[ - "f(q,t)_coh_weighted_%s%s" % pair - ][:] - self._outputData["s(q,f)_coh_total"][:] += self._outputData[ - "s(q,f)_coh_weighted_%s%s" % pair - ][:] - else: - self._outputData["f(q,t)_coh_total"][:] += ( - 2 * self._outputData["f(q,t)_coh_weighted_%s%s" % pair][:] - ) - self._outputData["s(q,f)_coh_total"][:] += ( - 2 * self._outputData["s(q,f)_coh_weighted_%s%s" % pair][:] - ) - - # Compute incoherent functions and structure factor - for element, ni in nAtomsPerElement.items(): - bi = ATOMS_DATABASE.get_atom_property(element, "b_incoherent2") - ni = nAtomsPerElement[element] - ci = ni / nTotalAtoms - - self._outputData["f(q,t)_inc_weighted_%s" % element][:] = ( - self._outputData["f(q,t)_inc_%s" % element][:] * ci * bi - ) - self._outputData["s(q,f)_inc_weighted_%s" % element][:] = ( - self._outputData["s(q,f)_inc_%s" % element][:] * ci * bi - ) - - self._outputData["f(q,t)_inc_total"][:] += self._outputData[ - "f(q,t)_inc_weighted_%s" % element - ][:] - self._outputData["s(q,f)_inc_total"][:] += self._outputData[ - "s(q,f)_inc_weighted_%s" % element - ][:] - - # Compute total F(Q,t) = inc + coh - self._outputData["f(q,t)_total"][:] = ( - self._outputData["f(q,t)_coh_total"][:] - + self._outputData["f(q,t)_inc_total"][:] - ) - self._outputData["s(q,f)_total"][:] = ( - self._outputData["s(q,f)_coh_total"][:] - + self._outputData["s(q,f)_inc_total"][:] - ) - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import itertools +import os + +import numpy as np + +from MDANSE.Chemistry import ATOMS_DATABASE +from MDANSE.Core.Error import Error +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Signal import correlation, get_spectrum + + +class NeutronDynamicTotalStructureFactorError(Error): + pass + + +class NeutronDynamicTotalStructureFactor(IJob): + """ + Computes the dynamic total structure factor for a set of atoms as the sum of the incoherent and coherent structure factors + """ + + label = "Neutron Dynamic Total Structure Factor" + + category = ( + "Analysis", + "Scattering", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["dcsf_input_file"] = ( + "HDFInputFileConfigurator", + {"label": "MDANSE Coherent Structure Factor", "default": "dcsf.h5"}, + ) + settings["disf_input_file"] = ( + "HDFInputFileConfigurator", + {"label": "MDANSE Incoherent Structure Factor", "default": "disf.h5"}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = 1 + + # Check time consistency + if "time" not in self.configuration["dcsf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No time found in dcsf input file" + ) + if "time" not in self.configuration["disf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No time found in disf input file" + ) + + dcsf_time = self.configuration["dcsf_input_file"]["instance"]["time"][:] + disf_time = self.configuration["disf_input_file"]["instance"]["time"][:] + + if not np.all(dcsf_time == disf_time): + raise NeutronDynamicTotalStructureFactorError( + "Inconsistent times between dcsf and disf input files" + ) + + self._outputData.add("time", "LineOutputVariable", dcsf_time, units="ps") + + # Check time window consistency + if "time_window" not in self.configuration["dcsf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No time window found in dcsf input file" + ) + if "time_window" not in self.configuration["disf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No time window found in disf input file" + ) + + dcsf_time_window = self.configuration["dcsf_input_file"]["instance"][ + "time_window" + ][:] + disf_time_window = self.configuration["disf_input_file"]["instance"][ + "time_window" + ][:] + + if not np.all(dcsf_time_window == disf_time_window): + raise NeutronDynamicTotalStructureFactorError( + "Inconsistent time windows between dcsf and disf input files" + ) + + self._outputData.add( + "time_window", "LineOutputVariable", dcsf_time_window, units="au" + ) + + # Check q values consistency + if "q" not in self.configuration["dcsf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No q values found in dcsf input file" + ) + if "q" not in self.configuration["disf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No q values found in disf input file" + ) + + dcsf_q = self.configuration["dcsf_input_file"]["instance"]["q"][:] + disf_q = self.configuration["disf_input_file"]["instance"]["q"][:] + + if not np.all(dcsf_q == disf_q): + raise NeutronDynamicTotalStructureFactorError( + "Inconsistent q values between dcsf and disf input files" + ) + + self._outputData.add("q", "LineOutputVariable", dcsf_q, units="1/nm") + + # Check omega consistency + if "omega" not in self.configuration["dcsf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No omega found in dcsf input file" + ) + if "omega" not in self.configuration["disf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No omega found in disf input file" + ) + + dcsf_omegas = self.configuration["dcsf_input_file"]["instance"]["omega"][:] + disf_omegas = self.configuration["disf_input_file"]["instance"]["omega"][:] + + if not np.all(dcsf_omegas == disf_omegas): + raise NeutronDynamicTotalStructureFactorError( + "Inconsistent omegas between dcsf and disf input files" + ) + + self._outputData.add("omega", "LineOutputVariable", dcsf_omegas, units="rad/ps") + + # Check omega window consistency + if "omega_window" not in self.configuration["dcsf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No omega window found in dcsf input file" + ) + if "omega_window" not in self.configuration["disf_input_file"]["instance"]: + raise NeutronDynamicTotalStructureFactorError( + "No omega window found in disf input file" + ) + + dcsf_omega_window = self.configuration["dcsf_input_file"]["instance"][ + "omega_window" + ][:] + disf_omega_window = self.configuration["disf_input_file"]["instance"][ + "omega_window" + ][:] + + if not np.all(dcsf_omega_window == disf_omega_window): + raise NeutronDynamicTotalStructureFactorError( + "Inconsistent omega windows between dcsf and disf input files" + ) + + self._outputData.add( + "omega_window", "LineOutputVariable", dcsf_omegas, units="au" + ) + + # Check f(q,t) and s(q,f) for dcsf + self._elementsPairs = sorted( + itertools.combinations_with_replacement( + self.configuration["atom_selection"]["unique_names"], 2 + ) + ) + for pair in self._elementsPairs: + if ( + "f(q,t)_{}{}".format(*pair) + not in self.configuration["dcsf_input_file"]["instance"] + ): + raise NeutronDynamicTotalStructureFactorError( + "Missing f(q,t) in dcsf input file" + ) + if ( + "s(q,f)_{}{}".format(*pair) + not in self.configuration["dcsf_input_file"]["instance"] + ): + raise NeutronDynamicTotalStructureFactorError( + "Missing s(q,f) in dcsf input file" + ) + + for element in self.configuration["atom_selection"]["unique_names"]: + if ( + "f(q,t)_{}".format(element) + not in self.configuration["disf_input_file"]["instance"] + ): + raise NeutronDynamicTotalStructureFactorError( + "Missing f(q,t) in disf input file" + ) + if ( + "s(q,f)_{}".format(element) + not in self.configuration["disf_input_file"]["instance"] + ): + raise NeutronDynamicTotalStructureFactorError( + "Missing s(q,f) in disf input file" + ) + + for element in self.configuration["atom_selection"]["unique_names"]: + fqt = self.configuration["disf_input_file"]["instance"][ + "f(q,t)_{}".format(element) + ] + sqf = self.configuration["disf_input_file"]["instance"][ + "s(q,f)_{}".format(element) + ] + self._outputData.add( + "f(q,t)_inc_%s" % element, + "SurfaceOutputVariable", + fqt, + axis="q|time", + units="au", + ) + self._outputData.add( + "s(q,f)_inc_%s" % element, + "SurfaceOutputVariable", + sqf, + axis="q|omega", + units="nm2/ps", + ) + self._outputData.add( + "f(q,t)_inc_weighted_%s" % element, + "SurfaceOutputVariable", + fqt.shape, + axis="q|time", + units="au", + ) + self._outputData.add( + "s(q,f)_inc_weighted_%s" % element, + "SurfaceOutputVariable", + sqf.shape, + axis="q|omega", + units="nm2/ps", + ) + + for pair in self._elementsPairs: + fqt = self.configuration["dcsf_input_file"]["instance"][ + "f(q,t)_{}{}".format(*pair) + ] + sqf = self.configuration["dcsf_input_file"]["instance"][ + "s(q,f)_{}{}".format(*pair) + ] + self._outputData.add( + "f(q,t)_coh_%s%s" % pair, + "SurfaceOutputVariable", + fqt, + axis="q|time", + units="au", + ) + self._outputData.add( + "s(q,f)_coh_%s%s" % pair, + "SurfaceOutputVariable", + sqf, + axis="q|omega", + units="nm2/ps", + ) + self._outputData.add( + "f(q,t)_coh_weighted_%s%s" % pair, + "SurfaceOutputVariable", + fqt.shape, + axis="q|time", + units="au", + ) + self._outputData.add( + "s(q,f)_coh_weighted_%s%s" % pair, + "SurfaceOutputVariable", + sqf.shape, + axis="q|omega", + units="nm2/ps", + ) + + nQValues = len(dcsf_q) + nTimes = len(dcsf_time) + nOmegas = len(dcsf_omegas) + + self._outputData.add( + "f(q,t)_coh_total", + "SurfaceOutputVariable", + (nQValues, nTimes), + axis="q|time", + units="au", + ) + self._outputData.add( + "f(q,t)_inc_total", + "SurfaceOutputVariable", + (nQValues, nTimes), + axis="q|time", + units="au", + ) + self._outputData.add( + "f(q,t)_total", + "SurfaceOutputVariable", + (nQValues, nTimes), + axis="q|time", + units="au", + ) + + self._outputData.add( + "s(q,f)_coh_total", + "SurfaceOutputVariable", + (nQValues, nOmegas), + axis="q|omega", + units="nm2/ps", + ) + self._outputData.add( + "s(q,f)_inc_total", + "SurfaceOutputVariable", + (nQValues, nOmegas), + axis="q|omega", + units="nm2/ps", + ) + self._outputData.add( + "s(q,f)_total", + "SurfaceOutputVariable", + (nQValues, nOmegas), + axis="q|omega", + units="nm2/ps", + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. rho (np.array): The exponential part of I(k,t) + """ + + return index, None + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...) + """ + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + + # Compute concentrations + nTotalAtoms = 0 + for val in list(nAtomsPerElement.values()): + nTotalAtoms += val + + # Compute coherent functions and structure factor + for pair in self._elementsPairs: + bi = ATOMS_DATABASE.get_atom_property(pair[0], "b_coherent") + bj = ATOMS_DATABASE.get_atom_property(pair[1], "b_coherent") + ni = nAtomsPerElement[pair[0]] + nj = nAtomsPerElement[pair[1]] + ci = ni / nTotalAtoms + cj = nj / nTotalAtoms + + self._outputData["f(q,t)_coh_weighted_%s%s" % pair][:] = ( + self._outputData["f(q,t)_coh_%s%s" % pair][:] + * np.sqrt(ci * cj) + * bi + * bj + ) + self._outputData["s(q,f)_coh_weighted_%s%s" % pair][:] = ( + self._outputData["s(q,f)_coh_%s%s" % pair][:] + * np.sqrt(ci * cj) + * bi + * bj + ) + if pair[0] == pair[1]: # Add a factor 2 if the two elements are different + self._outputData["f(q,t)_coh_total"][:] += self._outputData[ + "f(q,t)_coh_weighted_%s%s" % pair + ][:] + self._outputData["s(q,f)_coh_total"][:] += self._outputData[ + "s(q,f)_coh_weighted_%s%s" % pair + ][:] + else: + self._outputData["f(q,t)_coh_total"][:] += ( + 2 * self._outputData["f(q,t)_coh_weighted_%s%s" % pair][:] + ) + self._outputData["s(q,f)_coh_total"][:] += ( + 2 * self._outputData["s(q,f)_coh_weighted_%s%s" % pair][:] + ) + + # Compute incoherent functions and structure factor + for element, ni in nAtomsPerElement.items(): + bi = ATOMS_DATABASE.get_atom_property(element, "b_incoherent2") + ni = nAtomsPerElement[element] + ci = ni / nTotalAtoms + + self._outputData["f(q,t)_inc_weighted_%s" % element][:] = ( + self._outputData["f(q,t)_inc_%s" % element][:] * ci * bi + ) + self._outputData["s(q,f)_inc_weighted_%s" % element][:] = ( + self._outputData["s(q,f)_inc_%s" % element][:] * ci * bi + ) + + self._outputData["f(q,t)_inc_total"][:] += self._outputData[ + "f(q,t)_inc_weighted_%s" % element + ][:] + self._outputData["s(q,f)_inc_total"][:] += self._outputData[ + "s(q,f)_inc_weighted_%s" % element + ][:] + + # Compute total F(Q,t) = inc + coh + self._outputData["f(q,t)_total"][:] = ( + self._outputData["f(q,t)_coh_total"][:] + + self._outputData["f(q,t)_inc_total"][:] + ) + self._outputData["s(q,f)_total"][:] = ( + self._outputData["s(q,f)_coh_total"][:] + + self._outputData["s(q,f)_inc_total"][:] + ) + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py b/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py index 843251001f..a4f7b1d9bd 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py @@ -1,266 +1,270 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/OrderParameter.py -# @brief Implements module/class/test OrderParameter -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import os - -import numpy as np - -from MDANSE.Mathematics.Signal import correlation -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.LinearAlgebra import Vector -from MDANSE.Mathematics.Transformation import Rotation - - -class OrderParameter(IJob): - """ - The combination of NMR and MD simulation data is very powerful in the study of conformational dynamics of proteins. NMR relaxation - spectroscopy is a unique approach for a site-specific investigation of both global tumbling and internal motions of proteins. - The molecular motions modulate the magnetic interactions between the nuclear spins and lead for each nuclear spin to a relaxation - behaviour which reflects its environment. - - The relationship between microscopic motions and measured spin relaxation rates is given by Redfield's theory. The relaxation - measurements probe the relaxation dynamics of a selected nuclear spin at only a few frequencies. Moreover, only a limited number - of independent observables are accessible. Hence, to relate relaxation data to protein dynamics, a dynamical model for molecular - motions or a functional form, depending on a limited number of adjustable parameters, are required. - - The generalized order parameter, indicates the degree of spatial restriction of the internal motions of a bond vector, while the - characteristic time is an effective correlation time, setting the time scale of the internal relaxation processes. The resulting - values range from 0 (completely disordered) to 1 (fully ordered). - - **Calculation:** \n - angle at time T is calculated as the following: \n - .. math:: \\overrightarrow{vector} = \\overrightarrow{direction} - \\overrightarrow{origin} - .. math:: \phi(T = T_{1}-T_{0}) = arcos( \\overrightarrow{vector(T_{1})} . \\overrightarrow{vector(T_{0})} ) - - **Output:** \n - #. angular_correlation_legendre_1st: :math:`` - #. angular_correlation_legendre_2nd: :math:`<\\frac{1}{2}(3cos(\phi(T))^{2}-1)>` - - **Acknowledgement**\n - AOUN Bachir, PELLEGRINI Eric - """ - - label = "Order parameter" - - category = ( - "Analysis", - "Dynamics", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ( - "HDFTrajectoryConfigurator", - {}, - ) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["axis_selection"] = ( - "AtomsListConfigurator", - { - "dependencies": {"trajectory": "trajectory"}, - "nAtoms": 2, - "default": ("C284H438N84O79S7", ("C", "C_beta")), - }, - ) - settings["reference_direction"] = ( - "VectorConfigurator", - {"default": [0, 0, 1], "notNull": True, "normalize": True}, - ) - settings["per_axis"] = ( - "BooleanConfigurator", - {"label": "output contribution per axis", "default": False}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self._nFrames = self.configuration["frames"]["number"] - self._nAxis = self.configuration["axis_selection"]["n_values"] - - self.numberOfSteps = self._nAxis - - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["time"], - units="ps", - ) - - self._outputData.add( - "axis_index", - "LineOutputVariable", - np.arange(self.configuration["axis_selection"]["n_values"]), - units="au", - ) - - self._zAxis = Vector([0, 0, 1]) - refAxis = self.configuration["reference_direction"]["value"] - axis = self._zAxis.cross(refAxis) - - theta = np.arctan2(axis.length(), self._zAxis * refAxis) - - try: - self._rotation = Rotation(axis, theta).tensor.array - except ZeroDivisionError: - self._doRotation = False - else: - self._doRotation = True - - self._outputData.add( - "p1", "LineOutputVariable", (self._nFrames,), axis="time", units="au" - ) - self._outputData.add( - "p2", "LineOutputVariable", (self._nFrames,), axis="time", units="au" - ) - self._outputData.add( - "s2", "LineOutputVariable", (self._nAxis,), axis="time", units="au" - ) - - if self.configuration["per_axis"]["value"]: - self._outputData.add( - "p1_per_axis", - "SurfaceOutputVariable", - (self._nAxis, self._nFrames), - axis="axis_index|time", - units="au", - ) - self._outputData.add( - "p2_per_axis", - "SurfaceOutputVariable", - (self._nAxis, self._nFrames), - axis="axis_index|time", - units="au", - ) - - def run_step(self, index): - """ - Runs a single step of the job. - - :param index: the index of the step. - :type index: int - :return: a 2-tuple whose 1st element is the index of the step and 2nd element resp. p1, p2, s2 vectors. - :rtype: 2-tuple - """ - - e1, e2 = self.configuration["axis_selection"]["atoms"][index] - - serie1 = self.configuration["trajectory"]["instance"].read_atomic_trajectory( - e1, - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - serie2 = self.configuration["trajectory"]["instance"].read_atomic_trajectory( - e2, - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - diff = serie2 - serie1 - - modulus = np.sqrt(np.sum(diff**2, 1)) - - diff /= modulus[:, np.newaxis] - - # shape (3,n) - tDiff = diff.T - - if self._doRotation: - diff = np.dot(self._rotation, tDiff) - - costheta = np.dot(self._zAxis.array, tDiff) - sintheta = np.sqrt(np.sum(np.cross(self._zAxis, tDiff, axisb=0) ** 2, 1)) - - cosphi = tDiff[0, :] / sintheta - sinphi = tDiff[1, :] / sintheta - - tr2 = 3.0 * costheta**2 - 1.0 - cos2phi = 2.0 * cosphi**2 - 1.0 - sin2phi = 2.0 * sinphi * cosphi - cossintheta = costheta * sintheta - sintheta_sq = sintheta**2 - - # 1st order legendre polynomia - p1 = correlation(costheta) - - # Formula for the 2nd legendre polynomia applied to spherical coordinates - p2 = ( - 0.25 * correlation(tr2) - + 3.00 * correlation(cosphi * cossintheta) - + 3.00 * correlation(sinphi * cossintheta) - + 0.75 * correlation(cos2phi * sintheta_sq) - + 0.75 * correlation(sin2phi * sintheta_sq) - ) - - # s2 calculation (s2 = lim (t->+inf) p2) - s2 = ( - 0.75 - * (np.sum(cos2phi * sintheta_sq) ** 2 + np.sum(sin2phi * sintheta_sq) ** 2) - + 3.00 - * (np.sum(cosphi * cossintheta) ** 2 + np.sum(sinphi * cossintheta) ** 2) - + 0.25 * np.sum(tr2) ** 2 - ) / self._nFrames**2 - - return index, (p1, p2, s2) - - def combine(self, index, x): - """ - Combines/synchronizes the output of `run_step` method. - - :param index: the index of the step. - :type index: int - :param x: the output of `run_step` method. - :type x: any python object - """ - - p1, p2, s2 = x - - self._outputData["p1"] += p1 - self._outputData["p2"] += p2 - self._outputData["s2"][index] = s2 - - if self.configuration["per_axis"]["value"]: - self._outputData["p1_per_axis"][index, :] = p1 - self._outputData["p2_per_axis"][index, :] = p2 - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - self._outputData["p1"] /= self._nAxis - self._outputData["p2"] /= self._nAxis - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import os + +import numpy as np + +from MDANSE.Mathematics.Signal import correlation +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.LinearAlgebra import Vector +from MDANSE.Mathematics.Transformation import Rotation + + +class OrderParameter(IJob): + """ + The combination of NMR and MD simulation data is very powerful in the study of conformational dynamics of proteins. NMR relaxation + spectroscopy is a unique approach for a site-specific investigation of both global tumbling and internal motions of proteins. + The molecular motions modulate the magnetic interactions between the nuclear spins and lead for each nuclear spin to a relaxation + behaviour which reflects its environment. + + The relationship between microscopic motions and measured spin relaxation rates is given by Redfield's theory. The relaxation + measurements probe the relaxation dynamics of a selected nuclear spin at only a few frequencies. Moreover, only a limited number + of independent observables are accessible. Hence, to relate relaxation data to protein dynamics, a dynamical model for molecular + motions or a functional form, depending on a limited number of adjustable parameters, are required. + + The generalized order parameter, indicates the degree of spatial restriction of the internal motions of a bond vector, while the + characteristic time is an effective correlation time, setting the time scale of the internal relaxation processes. The resulting + values range from 0 (completely disordered) to 1 (fully ordered). + + **Calculation:** \n + angle at time T is calculated as the following: \n + .. math:: \\overrightarrow{vector} = \\overrightarrow{direction} - \\overrightarrow{origin} + .. math:: \phi(T = T_{1}-T_{0}) = arcos( \\overrightarrow{vector(T_{1})} . \\overrightarrow{vector(T_{0})} ) + + **Output:** \n + #. angular_correlation_legendre_1st: :math:`` + #. angular_correlation_legendre_2nd: :math:`<\\frac{1}{2}(3cos(\phi(T))^{2}-1)>` + + **Acknowledgement**\n + AOUN Bachir, PELLEGRINI Eric + """ + + label = "Order parameter" + + category = ( + "Analysis", + "Dynamics", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ( + "HDFTrajectoryConfigurator", + {}, + ) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["axis_selection"] = ( + "AtomsListConfigurator", + { + "dependencies": {"trajectory": "trajectory"}, + "nAtoms": 2, + "default": ("C284H438N84O79S7", ("C", "C_beta")), + }, + ) + settings["reference_direction"] = ( + "VectorConfigurator", + {"default": [0, 0, 1], "notNull": True, "normalize": True}, + ) + settings["per_axis"] = ( + "BooleanConfigurator", + {"label": "output contribution per axis", "default": False}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self._nFrames = self.configuration["frames"]["number"] + self._nAxis = self.configuration["axis_selection"]["n_values"] + + self.numberOfSteps = self._nAxis + + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["time"], + units="ps", + ) + + self._outputData.add( + "axis_index", + "LineOutputVariable", + np.arange(self.configuration["axis_selection"]["n_values"]), + units="au", + ) + + self._zAxis = Vector([0, 0, 1]) + refAxis = self.configuration["reference_direction"]["value"] + axis = self._zAxis.cross(refAxis) + + theta = np.arctan2(axis.length(), self._zAxis * refAxis) + + try: + self._rotation = Rotation(axis, theta).tensor.array + except ZeroDivisionError: + self._doRotation = False + else: + self._doRotation = True + + self._outputData.add( + "p1", "LineOutputVariable", (self._nFrames,), axis="time", units="au" + ) + self._outputData.add( + "p2", "LineOutputVariable", (self._nFrames,), axis="time", units="au" + ) + self._outputData.add( + "s2", "LineOutputVariable", (self._nAxis,), axis="time", units="au" + ) + + if self.configuration["per_axis"]["value"]: + self._outputData.add( + "p1_per_axis", + "SurfaceOutputVariable", + (self._nAxis, self._nFrames), + axis="axis_index|time", + units="au", + ) + self._outputData.add( + "p2_per_axis", + "SurfaceOutputVariable", + (self._nAxis, self._nFrames), + axis="axis_index|time", + units="au", + ) + + def run_step(self, index): + """ + Runs a single step of the job. + + :param index: the index of the step. + :type index: int + :return: a 2-tuple whose 1st element is the index of the step and 2nd element resp. p1, p2, s2 vectors. + :rtype: 2-tuple + """ + + e1, e2 = self.configuration["axis_selection"]["atoms"][index] + + serie1 = self.configuration["trajectory"]["instance"].read_atomic_trajectory( + e1, + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + serie2 = self.configuration["trajectory"]["instance"].read_atomic_trajectory( + e2, + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + diff = serie2 - serie1 + + modulus = np.sqrt(np.sum(diff**2, 1)) + + diff /= modulus[:, np.newaxis] + + # shape (3,n) + tDiff = diff.T + + if self._doRotation: + diff = np.dot(self._rotation, tDiff) + + costheta = np.dot(self._zAxis.array, tDiff) + sintheta = np.sqrt(np.sum(np.cross(self._zAxis, tDiff, axisb=0) ** 2, 1)) + + cosphi = tDiff[0, :] / sintheta + sinphi = tDiff[1, :] / sintheta + + tr2 = 3.0 * costheta**2 - 1.0 + cos2phi = 2.0 * cosphi**2 - 1.0 + sin2phi = 2.0 * sinphi * cosphi + cossintheta = costheta * sintheta + sintheta_sq = sintheta**2 + + # 1st order legendre polynomia + p1 = correlation(costheta) + + # Formula for the 2nd legendre polynomia applied to spherical coordinates + p2 = ( + 0.25 * correlation(tr2) + + 3.00 * correlation(cosphi * cossintheta) + + 3.00 * correlation(sinphi * cossintheta) + + 0.75 * correlation(cos2phi * sintheta_sq) + + 0.75 * correlation(sin2phi * sintheta_sq) + ) + + # s2 calculation (s2 = lim (t->+inf) p2) + s2 = ( + 0.75 + * (np.sum(cos2phi * sintheta_sq) ** 2 + np.sum(sin2phi * sintheta_sq) ** 2) + + 3.00 + * (np.sum(cosphi * cossintheta) ** 2 + np.sum(sinphi * cossintheta) ** 2) + + 0.25 * np.sum(tr2) ** 2 + ) / self._nFrames**2 + + return index, (p1, p2, s2) + + def combine(self, index, x): + """ + Combines/synchronizes the output of `run_step` method. + + :param index: the index of the step. + :type index: int + :param x: the output of `run_step` method. + :type x: any python object + """ + + p1, p2, s2 = x + + self._outputData["p1"] += p1 + self._outputData["p2"] += p2 + self._outputData["s2"][index] = s2 + + if self.configuration["per_axis"]["value"]: + self._outputData["p1_per_axis"][index, :] = p1 + self._outputData["p2_per_axis"][index, :] = p2 + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + self._outputData["p1"] /= self._nAxis + self._outputData["p2"] /= self._nAxis + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py index b74e2ca56e..e3636f72c1 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py @@ -1,178 +1,182 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/PairDistributionFunction.py -# @brief Implements module/class/test PairDistributionFunction -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import numpy as np - -from MDANSE.Framework.Jobs.DistanceHistogram import DistanceHistogram -from MDANSE.Mathematics.Arithmetic import weight - - -class PairDistributionFunction(DistanceHistogram): - """ - The Pair-Distribution Function (PDF) is an example of a pair correlation function, which - describes how, on average, the atoms in a system are radially packed around each other. - This is a particularly effective way of describing the average structure of disordered - molecular systems such as liquids. Also in systems like liquids, where there is continual movement - of the atoms and a single snapshot of the system shows only the instantaneous disorder, it is - essential to determine the average structure. - - The PDF can be compared with experimental data from x-ray or neutron diffraction. - It can be used in conjunction with the inter-atomic pair potential - function to calculate the internal energy of the system, usually quite accurately. - Finally it can even be used to derive the inter-atomic potentials of mean force. - """ - - label = "Pair Distribution Function" - - enabled = True - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - npoints = len(self.configuration["r_values"]["mid_points"]) - - self._outputData.add( - "r", - "LineOutputVariable", - self.configuration["r_values"]["mid_points"], - units="nm", - ) - - for x, y in self._elementsPairs: - for i in ["pdf", "rdf", "tcf"]: - self._outputData.add( - "%s_intra_%s%s" % (i, x, y), - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "%s_inter_%s%s" % (i, x, y), - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "%s_total_%s%s" % (i, x, y), - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - - for i in ["pdf", "rdf", "tcf"]: - self._outputData.add( - "%s_intra_total" % i, - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "%s_inter_total" % i, - "LineOutputVariable", - (npoints,), - axis="r", - units="au", - ) - self._outputData.add( - "%s_total" % i, "LineOutputVariable", (npoints,), axis="r", units="au" - ) - - nFrames = self.configuration["frames"]["number"] - - self.averageDensity /= nFrames - - densityFactor = 4.0 * np.pi * self.configuration["r_values"]["mid_points"] - - shellSurfaces = densityFactor * self.configuration["r_values"]["mid_points"] - - shellVolumes = shellSurfaces * self.configuration["r_values"]["step"] - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - - for pair in self._elementsPairs: - ni = nAtomsPerElement[pair[0]] - nj = nAtomsPerElement[pair[1]] - - idi = self.selectedElements.index(pair[0]) - idj = self.selectedElements.index(pair[1]) - - if idi == idj: - nij = ni * (ni - 1) / 2.0 - else: - nij = ni * nj - self.hIntra[idi, idj] += self.hIntra[idj, idi] - self.hInter[idi, idj] += self.hInter[idj, idi] - - fact = nij * nFrames * shellVolumes - - pdf_intra = self.hIntra[idi, idj, :] / fact - pdf_inter = self.hInter[idi, idj, :] / fact - pdf_total = pdf_intra + pdf_inter - - for i, pdf in zip( - ["intra", "inter", "total"], [pdf_intra, pdf_inter, pdf_total] - ): - self._outputData["pdf_%s_%s%s" % (i, pair[0], pair[1])][:] = pdf - self._outputData["rdf_%s_%s%s" % (i, pair[0], pair[1])][:] = ( - shellSurfaces * self.averageDensity * pdf - ) - self._outputData["tcf_%s_%s%s" % (i, pair[0], pair[1])][:] = ( - densityFactor - * self.averageDensity - * (pdf if i == "intra" else pdf - 1) - ) - - weights = self.configuration["weights"].get_weights() - - for i in ["_intra", "_inter", ""]: - pdf = weight( - weights, - self._outputData, - nAtomsPerElement, - 2, - "pdf{}_%s%s".format(i if i else "_total"), - ) - self._outputData["pdf%s_total" % i][:] = pdf - self._outputData["rdf%s_total" % i][:] = ( - shellSurfaces * self.averageDensity * pdf - ) - self._outputData["tcf%s_total" % i][:] = ( - densityFactor - * self.averageDensity - * (pdf if i == "_intra" else pdf - 1) - ) - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() - - super(PairDistributionFunction, self).finalize() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import numpy as np + +from MDANSE.Framework.Jobs.DistanceHistogram import DistanceHistogram +from MDANSE.Mathematics.Arithmetic import weight + + +class PairDistributionFunction(DistanceHistogram): + """ + The Pair-Distribution Function (PDF) is an example of a pair correlation function, which + describes how, on average, the atoms in a system are radially packed around each other. + This is a particularly effective way of describing the average structure of disordered + molecular systems such as liquids. Also in systems like liquids, where there is continual movement + of the atoms and a single snapshot of the system shows only the instantaneous disorder, it is + essential to determine the average structure. + + The PDF can be compared with experimental data from x-ray or neutron diffraction. + It can be used in conjunction with the inter-atomic pair potential + function to calculate the internal energy of the system, usually quite accurately. + Finally it can even be used to derive the inter-atomic potentials of mean force. + """ + + label = "Pair Distribution Function" + + enabled = True + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + npoints = len(self.configuration["r_values"]["mid_points"]) + + self._outputData.add( + "r", + "LineOutputVariable", + self.configuration["r_values"]["mid_points"], + units="nm", + ) + + for x, y in self._elementsPairs: + for i in ["pdf", "rdf", "tcf"]: + self._outputData.add( + "%s_intra_%s%s" % (i, x, y), + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "%s_inter_%s%s" % (i, x, y), + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "%s_total_%s%s" % (i, x, y), + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + + for i in ["pdf", "rdf", "tcf"]: + self._outputData.add( + "%s_intra_total" % i, + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "%s_inter_total" % i, + "LineOutputVariable", + (npoints,), + axis="r", + units="au", + ) + self._outputData.add( + "%s_total" % i, "LineOutputVariable", (npoints,), axis="r", units="au" + ) + + nFrames = self.configuration["frames"]["number"] + + self.averageDensity /= nFrames + + densityFactor = 4.0 * np.pi * self.configuration["r_values"]["mid_points"] + + shellSurfaces = densityFactor * self.configuration["r_values"]["mid_points"] + + shellVolumes = shellSurfaces * self.configuration["r_values"]["step"] + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + + for pair in self._elementsPairs: + ni = nAtomsPerElement[pair[0]] + nj = nAtomsPerElement[pair[1]] + + idi = self.selectedElements.index(pair[0]) + idj = self.selectedElements.index(pair[1]) + + if idi == idj: + nij = ni * (ni - 1) / 2.0 + else: + nij = ni * nj + self.hIntra[idi, idj] += self.hIntra[idj, idi] + self.hInter[idi, idj] += self.hInter[idj, idi] + + fact = nij * nFrames * shellVolumes + + pdf_intra = self.hIntra[idi, idj, :] / fact + pdf_inter = self.hInter[idi, idj, :] / fact + pdf_total = pdf_intra + pdf_inter + + for i, pdf in zip( + ["intra", "inter", "total"], [pdf_intra, pdf_inter, pdf_total] + ): + self._outputData["pdf_%s_%s%s" % (i, pair[0], pair[1])][:] = pdf + self._outputData["rdf_%s_%s%s" % (i, pair[0], pair[1])][:] = ( + shellSurfaces * self.averageDensity * pdf + ) + self._outputData["tcf_%s_%s%s" % (i, pair[0], pair[1])][:] = ( + densityFactor + * self.averageDensity + * (pdf if i == "intra" else pdf - 1) + ) + + weights = self.configuration["weights"].get_weights() + + for i in ["_intra", "_inter", ""]: + pdf = weight( + weights, + self._outputData, + nAtomsPerElement, + 2, + "pdf{}_%s%s".format(i if i else "_total"), + ) + self._outputData["pdf%s_total" % i][:] = pdf + self._outputData["rdf%s_total" % i][:] = ( + shellSurfaces * self.averageDensity * pdf + ) + self._outputData["tcf%s_total" % i][:] = ( + densityFactor + * self.averageDensity + * (pdf if i == "_intra" else pdf - 1) + ) + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() + + super(PairDistributionFunction, self).finalize() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py index 94dc266dc4..1d48316487 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/PositionAutoCorrelationFunction.py -# @brief Implements module/class/test PositionAutoCorrelationFunction +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py b/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py index 6098fa6a60..a73318c411 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py @@ -1,136 +1,140 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/RadiusOfGyration.py -# @brief Implements module/class/test RadiusOfGyration -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.MolecularDynamics.Analysis import radius_of_gyration - - -class RadiusOfGyration(IJob): - """ - Radius Of Gyration (ROG) is a measure of the size of an object, - a surface, or an ensemble of points. It is calculated as the Root Mean Square Distance between - the system and a reference which, in MDANSE, is the centre of gravity of the system. - """ - - label = "Radius of Gyration" - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Computes the pair distribution function for a set of atoms. - """ - self.numberOfSteps = self.configuration["frames"]["number"] - - # Will store the time. - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["time"], - units="ps", - ) - - self._outputData.add( - "rog", - "LineOutputVariable", - (self.configuration["frames"]["number"],), - axis="time", - units="nm", - ) - - self._indexes = [ - idx - for idxs in self.configuration["atom_selection"]["indexes"] - for idx in idxs - ] - - self._masses = np.array( - [ - m - for masses in self._configuration["atom_selection"]["masses"] - for m in masses - ], - dtype=np.float64, - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. rog (float): The radius of gyration - """ - - # get the Frame index - frameIndex = self.configuration["frames"]["value"][index] - - conf = self.configuration["trajectory"]["instance"].configuration(frameIndex) - - rog = radius_of_gyration( - conf["coordinates"][self._indexes, :], masses=self._masses, root=True - ) - - return index, rog - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - self._outputData["rog"][index] = x - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - # Write the output variables. - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.MolecularDynamics.Analysis import radius_of_gyration + + +class RadiusOfGyration(IJob): + """ + Radius Of Gyration (ROG) is a measure of the size of an object, + a surface, or an ensemble of points. It is calculated as the Root Mean Square Distance between + the system and a reference which, in MDANSE, is the centre of gravity of the system. + """ + + label = "Radius of Gyration" + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Computes the pair distribution function for a set of atoms. + """ + self.numberOfSteps = self.configuration["frames"]["number"] + + # Will store the time. + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["time"], + units="ps", + ) + + self._outputData.add( + "rog", + "LineOutputVariable", + (self.configuration["frames"]["number"],), + axis="time", + units="nm", + ) + + self._indexes = [ + idx + for idxs in self.configuration["atom_selection"]["indexes"] + for idx in idxs + ] + + self._masses = np.array( + [ + m + for masses in self._configuration["atom_selection"]["masses"] + for m in masses + ], + dtype=np.float64, + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. rog (float): The radius of gyration + """ + + # get the Frame index + frameIndex = self.configuration["frames"]["value"][index] + + conf = self.configuration["trajectory"]["instance"].configuration(frameIndex) + + rog = radius_of_gyration( + conf["coordinates"][self._indexes, :], masses=self._masses, root=True + ) + + return index, rog + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + self._outputData["rog"][index] = x + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + # Write the output variables. + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py index 376dc1df60..28062133df 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/RigidBodyTrajectory.py -# @brief Implements module/class/test RigidBodyTrajectory +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py index 56e03d7cb2..1452756f9b 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py @@ -1,173 +1,177 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/RootMeanSquareDeviation.py -# @brief Implements module/class/test RootMeanSquareDeviation -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Arithmetic import weight -from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms - - -class RootMeanSquareDeviation(IJob): - """ - The Root Mean-Square Deviation (RMSD) is one of the most popular measures of structural similarity. - It is a numerical measure of the difference between two structures. Typically, the RMSD is used to - quantify the structural evolution of the system during the simulation. - It can provide essential information about the structure, if it reached equilibrium or conversely - if major structural changes occurred during the simulation. - """ - - label = "Root Mean Square Deviation" - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["reference_frame"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["grouping_level"] = ( - "GroupingLevelConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - "atom_transmutation": "atom_transmutation", - } - }, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["weights"] = ( - "WeightsConfigurator", - {"dependencies": {"atom_selection": "atom_selection"}}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] - - self._referenceIndex = self.configuration["reference_frame"]["value"] - - # Will store the time. - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["duration"], - units="ps", - ) - - # Will store the mean square deviation - for element in self.configuration["atom_selection"]["unique_names"]: - self._outputData.add( - "rmsd_{}".format(element), - "LineOutputVariable", - (self.configuration["frames"]["number"],), - axis="time", - units="nm", - ) - - self._atoms = sorted_atoms( - self.configuration["trajectory"]["instance"].chemical_system.atom_list - ) - - def run_step(self, index): - """ - Runs a single step of the job. - - @param index: the index of the step. - @type index: int. - """ - - indexes = self.configuration["atom_selection"]["indexes"][index] - atoms = [self._atoms[idx] for idx in indexes] - - series = self.configuration["trajectory"]["instance"].read_com_trajectory( - atoms, - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - # Compute the squared sum of the difference between all the coordinate of atoms i and the reference ones - squaredDiff = np.sum((series - series[self._referenceIndex, :]) ** 2, axis=1) - - return index, squaredDiff - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - element = self.configuration["atom_selection"]["names"][index] - - self._outputData["rmsd_%s" % element] += x - - def finalize(self): - """ - Finalize the job. - """ - - # The RMSDs per element are averaged. - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for element, number in nAtomsPerElement.items(): - self._outputData["rmsd_{}".format(element)] /= number - - weights = self.configuration["weights"].get_weights() - rmsdTotal = weight(weights, self._outputData, nAtomsPerElement, 1, "rmsd_%s") - rmsdTotal = np.sqrt(rmsdTotal) - self._outputData.add( - "rmsd_total", "LineOutputVariable", rmsdTotal, axis="time", units="nm" - ) - - for element, number in nAtomsPerElement.items(): - self._outputData["rmsd_{}".format(element)] = np.sqrt( - self._outputData["rmsd_{}".format(element)] - ) - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Arithmetic import weight +from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms + + +class RootMeanSquareDeviation(IJob): + """ + The Root Mean-Square Deviation (RMSD) is one of the most popular measures of structural similarity. + It is a numerical measure of the difference between two structures. Typically, the RMSD is used to + quantify the structural evolution of the system during the simulation. + It can provide essential information about the structure, if it reached equilibrium or conversely + if major structural changes occurred during the simulation. + """ + + label = "Root Mean Square Deviation" + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["reference_frame"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["grouping_level"] = ( + "GroupingLevelConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + "atom_transmutation": "atom_transmutation", + } + }, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["weights"] = ( + "WeightsConfigurator", + {"dependencies": {"atom_selection": "atom_selection"}}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] + + self._referenceIndex = self.configuration["reference_frame"]["value"] + + # Will store the time. + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["duration"], + units="ps", + ) + + # Will store the mean square deviation + for element in self.configuration["atom_selection"]["unique_names"]: + self._outputData.add( + "rmsd_{}".format(element), + "LineOutputVariable", + (self.configuration["frames"]["number"],), + axis="time", + units="nm", + ) + + self._atoms = sorted_atoms( + self.configuration["trajectory"]["instance"].chemical_system.atom_list + ) + + def run_step(self, index): + """ + Runs a single step of the job. + + @param index: the index of the step. + @type index: int. + """ + + indexes = self.configuration["atom_selection"]["indexes"][index] + atoms = [self._atoms[idx] for idx in indexes] + + series = self.configuration["trajectory"]["instance"].read_com_trajectory( + atoms, + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + # Compute the squared sum of the difference between all the coordinate of atoms i and the reference ones + squaredDiff = np.sum((series - series[self._referenceIndex, :]) ** 2, axis=1) + + return index, squaredDiff + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + element = self.configuration["atom_selection"]["names"][index] + + self._outputData["rmsd_%s" % element] += x + + def finalize(self): + """ + Finalize the job. + """ + + # The RMSDs per element are averaged. + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for element, number in nAtomsPerElement.items(): + self._outputData["rmsd_{}".format(element)] /= number + + weights = self.configuration["weights"].get_weights() + rmsdTotal = weight(weights, self._outputData, nAtomsPerElement, 1, "rmsd_%s") + rmsdTotal = np.sqrt(rmsdTotal) + self._outputData.add( + "rmsd_total", "LineOutputVariable", rmsdTotal, axis="time", units="nm" + ) + + for element, number in nAtomsPerElement.items(): + self._outputData["rmsd_{}".format(element)] = np.sqrt( + self._outputData["rmsd_{}".format(element)] + ) + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py index 0b9606c5d2..d72d3d3a2c 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py @@ -1,139 +1,143 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/RootMeanSquareFluctuation.py -# @brief Implements module/class/test RootMeanSquareFluctuation -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.MolecularDynamics.Analysis import mean_square_fluctuation -from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms - - -class RootMeanSquareFluctuation(IJob): - """ - The root mean square fluctuation (RMSF) for a set of atoms is similar to the square root - of the mean square displacement (MSD), except that it is spatially resolved (by atom/residue/etc) - rather than time resolved. It reveals the dynamical heterogeneity of the molecule over the course - of a MD simulation. - """ - - label = "Root Mean Square Fluctuation" - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["grouping_level"] = ( - "GroupingLevelConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] - - # Will store the indexes. - indexes = [ - idx - for idxs in self.configuration["atom_selection"]["indexes"] - for idx in idxs - ] - self._outputData.add("indexes", "LineOutputVariable", indexes) - - # Will store the mean square fluctuation evolution. - self._outputData.add( - "rmsf", - "LineOutputVariable", - (self.configuration["atom_selection"]["selection_length"],), - axis="indexes", - units="nm", - ) - - self._atoms = sorted_atoms( - self.configuration["trajectory"]["instance"].chemical_system.atom_list - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. rmsf (np.array): the calculated root mean square fluctuation for atom index - """ - # read the particle trajectory - indexes = self.configuration["atom_selection"]["indexes"][index] - atoms = [self._atoms[idx] for idx in indexes] - - series = self.configuration["trajectory"]["instance"].read_com_trajectory( - atoms, - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - rmsf = mean_square_fluctuation(series, root=True) - - return index, rmsf - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - self._outputData["rmsf"][index] = x - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - # Write the output variables. - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.MolecularDynamics.Analysis import mean_square_fluctuation +from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms + + +class RootMeanSquareFluctuation(IJob): + """ + The root mean square fluctuation (RMSF) for a set of atoms is similar to the square root + of the mean square displacement (MSD), except that it is spatially resolved (by atom/residue/etc) + rather than time resolved. It reveals the dynamical heterogeneity of the molecule over the course + of a MD simulation. + """ + + label = "Root Mean Square Fluctuation" + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["grouping_level"] = ( + "GroupingLevelConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] + + # Will store the indexes. + indexes = [ + idx + for idxs in self.configuration["atom_selection"]["indexes"] + for idx in idxs + ] + self._outputData.add("indexes", "LineOutputVariable", indexes) + + # Will store the mean square fluctuation evolution. + self._outputData.add( + "rmsf", + "LineOutputVariable", + (self.configuration["atom_selection"]["selection_length"],), + axis="indexes", + units="nm", + ) + + self._atoms = sorted_atoms( + self.configuration["trajectory"]["instance"].chemical_system.atom_list + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. rmsf (np.array): the calculated root mean square fluctuation for atom index + """ + # read the particle trajectory + indexes = self.configuration["atom_selection"]["indexes"][index] + atoms = [self._atoms[idx] for idx in indexes] + + series = self.configuration["trajectory"]["instance"].read_com_trajectory( + atoms, + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + rmsf = mean_square_fluctuation(series, root=True) + + return index, rmsf + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + self._outputData["rmsf"][index] = x + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + # Write the output variables. + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py b/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py index 1fb43c2f0d..c2b6d9ed97 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/SolventAccessibleSurface.py -# @brief Implements module/class/test SolventAccessibleSurface +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py index f5e0fe8f19..009c0f6303 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py @@ -1,205 +1,209 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/StaticStructureFactor.py -# @brief Implements module/class/test StaticStructureFactor -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Framework.Jobs.DistanceHistogram import DistanceHistogram -from MDANSE.Mathematics.Arithmetic import weight - - -class StaticStructureFactor(DistanceHistogram): - """ - Computes the static structure factor from the pair distribution function for a set of atoms. - The result is defined as S(q) = F_coh(q, t = 0). - """ - - label = "Static Structure Factor" - - enabled = True - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["r_values"] = ( - "RangeConfigurator", - {"valueType": float, "includeLast": True, "mini": 0.0}, - ) - settings["q_values"] = ( - "RangeConfigurator", - {"valueType": float, "includeLast": True, "mini": 0.0}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["weights"] = ( - "WeightsConfigurator", - { - "default": "b_coherent", - "dependencies": { - "atom_selection": "atom_selection", - "atom_transmutation": "atom_transmutation", - }, - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - nq = self.configuration["q_values"]["number"] - - nFrames = self.configuration["frames"]["number"] - - self.averageDensity /= nFrames - - densityFactor = 4.0 * np.pi * self.configuration["r_values"]["mid_points"] - - shellSurfaces = densityFactor * self.configuration["r_values"]["mid_points"] - - shellVolumes = shellSurfaces * self.configuration["r_values"]["step"] - - self._outputData.add( - "q", - "LineOutputVariable", - self.configuration["q_values"]["value"], - units="1/nm", - ) - - q = self._outputData["q"] - r = self.configuration["r_values"]["mid_points"] - - fact1 = 4.0 * np.pi * self.averageDensity - - sincqr = np.sinc(np.outer(q, r) / np.pi) - - dr = self.configuration["r_values"]["step"] - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for pair in self._elementsPairs: - self._outputData.add( - "ssf_intra_%s%s" % pair, - "LineOutputVariable", - (nq,), - axis="q", - units="au", - ) - self._outputData.add( - "ssf_inter_%s%s" % pair, - "LineOutputVariable", - (nq,), - axis="q", - units="au", - ) - self._outputData.add( - "ssf_total_%s%s" % pair, - "LineOutputVariable", - (nq,), - axis="q", - units="au", - ) - - ni = nAtomsPerElement[pair[0]] - nj = nAtomsPerElement[pair[1]] - - idi = self.selectedElements.index(pair[0]) - idj = self.selectedElements.index(pair[1]) - - if pair[0] == pair[1]: - nij = ni * (ni - 1) / 2.0 - else: - nij = ni * nj - self.hIntra[idi, idj] += self.hIntra[idj, idi] - self.hInter[idi, idj] += self.hInter[idj, idi] - - fact = nij * nFrames * shellVolumes - - pdfIntra = self.hIntra[idi, idj, :] / fact - pdfInter = self.hInter[idi, idj, :] / fact - - self._outputData["ssf_intra_%s%s" % pair][:] = ( - fact1 * np.sum((r**2) * pdfIntra * sincqr, axis=1) * dr - ) - self._outputData["ssf_inter_%s%s" % pair][:] = ( - 1.0 + fact1 * np.sum((r**2) * (pdfInter - 1.0) * sincqr, axis=1) * dr - ) - self._outputData["ssf_total_%s%s" % pair][:] = ( - self._outputData["ssf_intra_%s%s" % pair][:] - + self._outputData["ssf_inter_%s%s" % pair][:] - ) - - self._outputData.add( - "ssf_intra", "LineOutputVariable", (nq,), axis="q", units="au" - ) - self._outputData.add( - "ssf_inter", - "LineOutputVariable", - (nq,), - axis="q", - units="au", - ) - self._outputData.add( - "ssf_total", "LineOutputVariable", (nq,), axis="q", units="au" - ) - - weights = self.configuration["weights"].get_weights() - - ssfIntra = weight( - weights, self._outputData, nAtomsPerElement, 2, "ssf_intra_%s%s" - ) - self._outputData["ssf_intra"][:] = ssfIntra - - ssfInter = weight( - weights, self._outputData, nAtomsPerElement, 2, "ssf_inter_%s%s" - ) - - self._outputData["ssf_inter"][:] = ssfInter - - self._outputData["ssf_total"][:] = ssfIntra + ssfInter - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Framework.Jobs.DistanceHistogram import DistanceHistogram +from MDANSE.Mathematics.Arithmetic import weight + + +class StaticStructureFactor(DistanceHistogram): + """ + Computes the static structure factor from the pair distribution function for a set of atoms. + The result is defined as S(q) = F_coh(q, t = 0). + """ + + label = "Static Structure Factor" + + enabled = True + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["r_values"] = ( + "RangeConfigurator", + {"valueType": float, "includeLast": True, "mini": 0.0}, + ) + settings["q_values"] = ( + "RangeConfigurator", + {"valueType": float, "includeLast": True, "mini": 0.0}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["weights"] = ( + "WeightsConfigurator", + { + "default": "b_coherent", + "dependencies": { + "atom_selection": "atom_selection", + "atom_transmutation": "atom_transmutation", + }, + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + nq = self.configuration["q_values"]["number"] + + nFrames = self.configuration["frames"]["number"] + + self.averageDensity /= nFrames + + densityFactor = 4.0 * np.pi * self.configuration["r_values"]["mid_points"] + + shellSurfaces = densityFactor * self.configuration["r_values"]["mid_points"] + + shellVolumes = shellSurfaces * self.configuration["r_values"]["step"] + + self._outputData.add( + "q", + "LineOutputVariable", + self.configuration["q_values"]["value"], + units="1/nm", + ) + + q = self._outputData["q"] + r = self.configuration["r_values"]["mid_points"] + + fact1 = 4.0 * np.pi * self.averageDensity + + sincqr = np.sinc(np.outer(q, r) / np.pi) + + dr = self.configuration["r_values"]["step"] + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for pair in self._elementsPairs: + self._outputData.add( + "ssf_intra_%s%s" % pair, + "LineOutputVariable", + (nq,), + axis="q", + units="au", + ) + self._outputData.add( + "ssf_inter_%s%s" % pair, + "LineOutputVariable", + (nq,), + axis="q", + units="au", + ) + self._outputData.add( + "ssf_total_%s%s" % pair, + "LineOutputVariable", + (nq,), + axis="q", + units="au", + ) + + ni = nAtomsPerElement[pair[0]] + nj = nAtomsPerElement[pair[1]] + + idi = self.selectedElements.index(pair[0]) + idj = self.selectedElements.index(pair[1]) + + if pair[0] == pair[1]: + nij = ni * (ni - 1) / 2.0 + else: + nij = ni * nj + self.hIntra[idi, idj] += self.hIntra[idj, idi] + self.hInter[idi, idj] += self.hInter[idj, idi] + + fact = nij * nFrames * shellVolumes + + pdfIntra = self.hIntra[idi, idj, :] / fact + pdfInter = self.hInter[idi, idj, :] / fact + + self._outputData["ssf_intra_%s%s" % pair][:] = ( + fact1 * np.sum((r**2) * pdfIntra * sincqr, axis=1) * dr + ) + self._outputData["ssf_inter_%s%s" % pair][:] = ( + 1.0 + fact1 * np.sum((r**2) * (pdfInter - 1.0) * sincqr, axis=1) * dr + ) + self._outputData["ssf_total_%s%s" % pair][:] = ( + self._outputData["ssf_intra_%s%s" % pair][:] + + self._outputData["ssf_inter_%s%s" % pair][:] + ) + + self._outputData.add( + "ssf_intra", "LineOutputVariable", (nq,), axis="q", units="au" + ) + self._outputData.add( + "ssf_inter", + "LineOutputVariable", + (nq,), + axis="q", + units="au", + ) + self._outputData.add( + "ssf_total", "LineOutputVariable", (nq,), axis="q", units="au" + ) + + weights = self.configuration["weights"].get_weights() + + ssfIntra = weight( + weights, self._outputData, nAtomsPerElement, 2, "ssf_intra_%s%s" + ) + self._outputData["ssf_intra"][:] = ssfIntra + + ssfInter = weight( + weights, self._outputData, nAtomsPerElement, 2, "ssf_inter_%s%s" + ) + + self._outputData["ssf_inter"][:] = ssfInter + + self._outputData["ssf_total"][:] = ssfIntra + ssfInter + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py index 0482dd4fd6..2c923ba59b 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py @@ -1,148 +1,152 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/StructureFactorFromScatteringFunction.py -# @brief Implements module/class/test StructureFactorFromScatteringFunction -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import os - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Signal import get_spectrum - - -class StructureFactorFromScatteringFunction(IJob): - """ - Computes the structure factor from a HDF file containing an intermediate scattering function. - """ - - label = "Structure Factor From Scattering Function" - - category = ( - "Analysis", - "Scattering", - ) - - ancestor = ["hdf_data"] - - settings = collections.OrderedDict() - settings["sample_inc"] = ( - "HDFInputFileConfigurator", - { - "label": "MDANSE Incoherent Structure Factor", - "variables": ["time", "f(q,t)_total"], - "default": "disf_prot.h5", - }, - ) - settings["instrument_resolution"] = ( - "InstrumentResolutionConfigurator", - {"dependencies": {"frames": "sample_inc"}}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - # The number of steps is set to 1 as everything is performed in the finalize method - self.numberOfSteps = 1 - - inputFile = self.configuration["sample_inc"]["instance"] - - resolution = self.configuration["instrument_resolution"] - - self._outputData.add( - "time", "LineOutputVariable", inputFile["time"][:], units="ps" - ) - - self._outputData.add( - "time_window", - "LineOutputVariable", - inputFile["time_window"][:], - axis="time", - units="au", - ) - - self._outputData.add("q", "LineOutputVariable", inputFile["q"][:], units="1/nm") - - self._outputData.add( - "omega", "LineOutputVariable", resolution["omega"], units="rad/ps" - ) - - self._outputData.add( - "omega_window", - "LineOutputVariable", - resolution["omega_window"], - axis="omega", - units="au", - ) - - nQVectors = len(inputFile["q"][:]) - nOmegas = resolution["n_omegas"] - - for k, v in list(inputFile.items()): - if k.startswith("f(q,t)_"): - self._outputData.add( - k, "SurfaceOutputVariable", v[:], axis="q|time", units="au" - ) - suffix = k[7:] - self._outputData.add( - "s(q,f)_%s" % suffix, - "SurfaceOutputVariable", - (nQVectors, nOmegas), - axis="q|omega", - units="au", - ) - self._outputData["s(q,f)_%s" % suffix][:] = get_spectrum( - v[:], - self.configuration["instrument_resolution"]["time_window"], - self.configuration["instrument_resolution"]["time_step"], - axis=1, - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - """ - - return index, None - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - pass - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["sample_inc"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import os + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Signal import get_spectrum + + +class StructureFactorFromScatteringFunction(IJob): + """ + Computes the structure factor from a HDF file containing an intermediate scattering function. + """ + + label = "Structure Factor From Scattering Function" + + category = ( + "Analysis", + "Scattering", + ) + + ancestor = ["hdf_data"] + + settings = collections.OrderedDict() + settings["sample_inc"] = ( + "HDFInputFileConfigurator", + { + "label": "MDANSE Incoherent Structure Factor", + "variables": ["time", "f(q,t)_total"], + "default": "disf_prot.h5", + }, + ) + settings["instrument_resolution"] = ( + "InstrumentResolutionConfigurator", + {"dependencies": {"frames": "sample_inc"}}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + # The number of steps is set to 1 as everything is performed in the finalize method + self.numberOfSteps = 1 + + inputFile = self.configuration["sample_inc"]["instance"] + + resolution = self.configuration["instrument_resolution"] + + self._outputData.add( + "time", "LineOutputVariable", inputFile["time"][:], units="ps" + ) + + self._outputData.add( + "time_window", + "LineOutputVariable", + inputFile["time_window"][:], + axis="time", + units="au", + ) + + self._outputData.add("q", "LineOutputVariable", inputFile["q"][:], units="1/nm") + + self._outputData.add( + "omega", "LineOutputVariable", resolution["omega"], units="rad/ps" + ) + + self._outputData.add( + "omega_window", + "LineOutputVariable", + resolution["omega_window"], + axis="omega", + units="au", + ) + + nQVectors = len(inputFile["q"][:]) + nOmegas = resolution["n_omegas"] + + for k, v in list(inputFile.items()): + if k.startswith("f(q,t)_"): + self._outputData.add( + k, "SurfaceOutputVariable", v[:], axis="q|time", units="au" + ) + suffix = k[7:] + self._outputData.add( + "s(q,f)_%s" % suffix, + "SurfaceOutputVariable", + (nQVectors, nOmegas), + axis="q|omega", + units="au", + ) + self._outputData["s(q,f)_%s" % suffix][:] = get_spectrum( + v[:], + self.configuration["instrument_resolution"]["time_window"], + self.configuration["instrument_resolution"]["time_step"], + axis=1, + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + """ + + return index, None + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + pass + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["sample_inc"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py b/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py index ea5dbcc215..25a47fe5b9 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/Temperature.py -# @brief Implements module/class/test Temperature +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py index a30378005c..10c3e32f69 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/UnfoldedTrajectory.py -# @brief Implements module/class/test UnfoldedTrajectory +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py index 14c2e5900c..f97fa251a1 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py @@ -1,226 +1,230 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/VelocityAutoCorrelationFunction.py -# @brief Implements module/class/test VelocityAutoCorrelationFunction -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -from MDANSE.Framework.Jobs.IJob import IJob -from MDANSE.Mathematics.Arithmetic import weight -from MDANSE.Mathematics.Signal import correlation, differentiate, normalize -from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms - - -class VelocityAutoCorrelationFunction(IJob): - """ - The Velocity AutoCorrelation Function (VACF) is a property describing the dynamics of a molecular system. - It reveals the underlying nature of the forces acting on the system. Its Fourier Transform gives the cartesian density of states for a set of atoms. - - In a molecular system that would be made of non interacting particles, the velocities would be constant - at any time giving a VACF of constant value. In the gas-phase, the magnitude and direction of the velocity of a particle - will change gradually over time due collisions with other particles. In this case, the VACF is represented by a decaying exponential. - - In the solid phase, the interactions are much stronger and, as a result, the atoms are bound to a given, equilibrium position from - which they move backwards and forwards. The oscillations are not be of equal magnitude however, but decay in time, because there are - anharmonic, perturbative forces which disrupt the oscillatory motion. In this case, the VACF looks like a damped harmonic motion. - - In the liquid phase, the atoms have more freedom than in the solid phase and because of the diffusion process, the oscillatory motion - seen in solid phase is damped rapidly depending on the density of the system. So, the VACF tends to have one very damped oscillation - before decaying to zero. The decaying time can be considered as the average time for a collision between two atoms. - - As well as revealing the dynamical processes in a system, the VACF has other interesting properties. Firstly, its Fourier transform, - a.k.a as vibrational Density Of States (vDOS) can be used to reveal the underlying frequencies of the molecular processes. This is closely - related to the infra-red spectrum of the system, which is also concerned with vibration on the molecular scale. Secondly, provided the VACF - decays to zero at long time, the function may be integrated mathematically to calculate the diffusion coefficient D, as in: - - .. math:: D = \\frac{1}{3}\int_{0}^{+\infty}{dt} - - This is a special case of a more general relationship between the VACF and the mean square displacement, and belongs to a class of properties - known as the Green-Kubo relations, which relate correlation functions to so-called transport coefficients. - """ - - label = "Velocity AutoCorrelation Function" - - category = ( - "Analysis", - "Dynamics", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["interpolation_order"] = ( - "InterpolationOrderConfigurator", - {"label": "velocities", "dependencies": {"trajectory": "trajectory"}}, - ) - settings["projection"] = ( - "ProjectionConfigurator", - {"label": "project coordinates"}, - ) - settings["normalize"] = ("BooleanConfigurator", {"default": False}) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["weights"] = ( - "WeightsConfigurator", - {"dependencies": {"atom_selection": "atom_selection"}}, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def initialize(self): - """ - Initialize the input parameters and analysis self variables - """ - - self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] - - # Will store the time. - self._outputData.add( - "time", - "LineOutputVariable", - self.configuration["frames"]["duration"], - units="ps", - ) - - # Will store the mean square displacement evolution. - for element in self.configuration["atom_selection"]["unique_names"]: - self._outputData.add( - "vacf_%s" % element, - "LineOutputVariable", - (self.configuration["frames"]["number"],), - axis="time", - units="nm2/ps2", - ) - - self._outputData.add( - "vacf_total", - "LineOutputVariable", - (self.configuration["frames"]["number"],), - axis="time", - units="nm2/ps2", - ) - - self._atoms = sorted_atoms( - self.configuration["trajectory"]["instance"].chemical_system.atom_list - ) - - def run_step(self, index): - """ - Runs a single step of the job.\n - - :Parameters: - #. index (int): The index of the step. - :Returns: - #. index (int): The index of the step. - #. atomicDOS (np.array): The calculated density of state for atom of index=index - #. atomicVACF (np.array): The calculated velocity auto-correlation function for atom of index=index - """ - - trajectory = self.configuration["trajectory"]["instance"] - - # get atom index - indexes = self.configuration["atom_selection"]["indexes"][index] - - if self.configuration["interpolation_order"]["value"] == 0: - series = trajectory.read_configuration_variable( - self.configuration["trajectory"]["instance"], - indexes[0], - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - variable="velocities", - ) - else: - series = trajectory.read_atomic_trajectory( - indexes[0], - first=self.configuration["frames"]["first"], - last=self.configuration["frames"]["last"] + 1, - step=self.configuration["frames"]["step"], - ) - - order = self.configuration["interpolation_order"]["value"] - for axis in range(3): - series[:, axis] = differentiate( - series[:, axis], - order=order, - dt=self.configuration["frames"]["time_step"], - ) - - series = self.configuration["projection"]["projector"](series) - - atomicVACF = correlation(series, axis=0, average=1) - - return index, atomicVACF - - def combine(self, index, x): - """ - Combines returned results of run_step.\n - :Parameters: - #. index (int): The index of the step.\n - #. x (any): The returned result(s) of run_step - """ - - # The symbol of the atom. - element = self.configuration["atom_selection"]["names"][index] - - self._outputData["vacf_%s" % element] += x - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for element, number in nAtomsPerElement.items(): - self._outputData["vacf_%s" % element] /= number - - weights = self.configuration["weights"].get_weights() - - vacfTotal = weight(weights, self._outputData, nAtomsPerElement, 1, "vacf_%s") - self._outputData["vacf_total"][:] = vacfTotal - - if self.configuration["normalize"]["value"]: - for element in nAtomsPerElement.keys(): - self._outputData["vacf_%s" % element] = normalize( - self._outputData["vacf_%s" % element], axis=0 - ) - self._outputData["vacf_total"] = normalize( - self._outputData["vacf_total"], axis=0 - ) - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +from MDANSE.Framework.Jobs.IJob import IJob +from MDANSE.Mathematics.Arithmetic import weight +from MDANSE.Mathematics.Signal import correlation, differentiate, normalize +from MDANSE.MolecularDynamics.TrajectoryUtils import sorted_atoms + + +class VelocityAutoCorrelationFunction(IJob): + """ + The Velocity AutoCorrelation Function (VACF) is a property describing the dynamics of a molecular system. + It reveals the underlying nature of the forces acting on the system. Its Fourier Transform gives the cartesian density of states for a set of atoms. + + In a molecular system that would be made of non interacting particles, the velocities would be constant + at any time giving a VACF of constant value. In the gas-phase, the magnitude and direction of the velocity of a particle + will change gradually over time due collisions with other particles. In this case, the VACF is represented by a decaying exponential. + + In the solid phase, the interactions are much stronger and, as a result, the atoms are bound to a given, equilibrium position from + which they move backwards and forwards. The oscillations are not be of equal magnitude however, but decay in time, because there are + anharmonic, perturbative forces which disrupt the oscillatory motion. In this case, the VACF looks like a damped harmonic motion. + + In the liquid phase, the atoms have more freedom than in the solid phase and because of the diffusion process, the oscillatory motion + seen in solid phase is damped rapidly depending on the density of the system. So, the VACF tends to have one very damped oscillation + before decaying to zero. The decaying time can be considered as the average time for a collision between two atoms. + + As well as revealing the dynamical processes in a system, the VACF has other interesting properties. Firstly, its Fourier transform, + a.k.a as vibrational Density Of States (vDOS) can be used to reveal the underlying frequencies of the molecular processes. This is closely + related to the infra-red spectrum of the system, which is also concerned with vibration on the molecular scale. Secondly, provided the VACF + decays to zero at long time, the function may be integrated mathematically to calculate the diffusion coefficient D, as in: + + .. math:: D = \\frac{1}{3}\int_{0}^{+\infty}{dt} + + This is a special case of a more general relationship between the VACF and the mean square displacement, and belongs to a class of properties + known as the Green-Kubo relations, which relate correlation functions to so-called transport coefficients. + """ + + label = "Velocity AutoCorrelation Function" + + category = ( + "Analysis", + "Dynamics", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["interpolation_order"] = ( + "InterpolationOrderConfigurator", + {"label": "velocities", "dependencies": {"trajectory": "trajectory"}}, + ) + settings["projection"] = ( + "ProjectionConfigurator", + {"label": "project coordinates"}, + ) + settings["normalize"] = ("BooleanConfigurator", {"default": False}) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["weights"] = ( + "WeightsConfigurator", + {"dependencies": {"atom_selection": "atom_selection"}}, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def initialize(self): + """ + Initialize the input parameters and analysis self variables + """ + + self.numberOfSteps = self.configuration["atom_selection"]["selection_length"] + + # Will store the time. + self._outputData.add( + "time", + "LineOutputVariable", + self.configuration["frames"]["duration"], + units="ps", + ) + + # Will store the mean square displacement evolution. + for element in self.configuration["atom_selection"]["unique_names"]: + self._outputData.add( + "vacf_%s" % element, + "LineOutputVariable", + (self.configuration["frames"]["number"],), + axis="time", + units="nm2/ps2", + ) + + self._outputData.add( + "vacf_total", + "LineOutputVariable", + (self.configuration["frames"]["number"],), + axis="time", + units="nm2/ps2", + ) + + self._atoms = sorted_atoms( + self.configuration["trajectory"]["instance"].chemical_system.atom_list + ) + + def run_step(self, index): + """ + Runs a single step of the job.\n + + :Parameters: + #. index (int): The index of the step. + :Returns: + #. index (int): The index of the step. + #. atomicDOS (np.array): The calculated density of state for atom of index=index + #. atomicVACF (np.array): The calculated velocity auto-correlation function for atom of index=index + """ + + trajectory = self.configuration["trajectory"]["instance"] + + # get atom index + indexes = self.configuration["atom_selection"]["indexes"][index] + + if self.configuration["interpolation_order"]["value"] == 0: + series = trajectory.read_configuration_variable( + self.configuration["trajectory"]["instance"], + indexes[0], + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + variable="velocities", + ) + else: + series = trajectory.read_atomic_trajectory( + indexes[0], + first=self.configuration["frames"]["first"], + last=self.configuration["frames"]["last"] + 1, + step=self.configuration["frames"]["step"], + ) + + order = self.configuration["interpolation_order"]["value"] + for axis in range(3): + series[:, axis] = differentiate( + series[:, axis], + order=order, + dt=self.configuration["frames"]["time_step"], + ) + + series = self.configuration["projection"]["projector"](series) + + atomicVACF = correlation(series, axis=0, average=1) + + return index, atomicVACF + + def combine(self, index, x): + """ + Combines returned results of run_step.\n + :Parameters: + #. index (int): The index of the step.\n + #. x (any): The returned result(s) of run_step + """ + + # The symbol of the atom. + element = self.configuration["atom_selection"]["names"][index] + + self._outputData["vacf_%s" % element] += x + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for element, number in nAtomsPerElement.items(): + self._outputData["vacf_%s" % element] /= number + + weights = self.configuration["weights"].get_weights() + + vacfTotal = weight(weights, self._outputData, nAtomsPerElement, 1, "vacf_%s") + self._outputData["vacf_total"][:] = vacfTotal + + if self.configuration["normalize"]["value"]: + for element in nAtomsPerElement.keys(): + self._outputData["vacf_%s" % element] = normalize( + self._outputData["vacf_%s" % element], axis=0 + ) + self._outputData["vacf_total"] = normalize( + self._outputData["vacf_total"], axis=0 + ) + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py b/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py index 2a4a25b927..abf051b58e 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/Voronoi.py -# @brief Implements module/class/test Voronoi +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import math diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py index 61d188b249..b180615dba 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py @@ -1,216 +1,220 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/Jobs/XRayStaticStructureFactor.py -# @brief Implements module/class/test XRayStaticStructureFactor -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Chemistry import ATOMS_DATABASE -from MDANSE.Framework.Jobs.DistanceHistogram import DistanceHistogram -from MDANSE.Mathematics.Arithmetic import weight - - -def atomic_scattering_factor(element, qvalues): - a = np.empty((4,), dtype=np.float64) - a[0] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_a1") - a[1] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_a2") - a[2] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_a3") - a[3] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_a4") - - b = np.empty((4,), dtype=np.float64) - b[0] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_b1") - b[1] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_b2") - b[2] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_b3") - b[3] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_b4") - - c = ATOMS_DATABASE.get_atom_property(element, "xray_asf_c") - - return c + np.sum( - a[:, np.newaxis] - * np.exp(-b[:, np.newaxis] * (qvalues[np.newaxis, :] / (4.0 * np.pi)) ** 2), - axis=0, - ) - - -class XRayStaticStructureFactor(DistanceHistogram): - """ - Computes the X-ray static structure from the pair distribution function for a set of atoms, - taking into account the atomic form factor for X-rays. - """ - - label = "XRay Static Structure Factor" - - enabled = True - - category = ( - "Analysis", - "Structure", - ) - - ancestor = ["hdf_trajectory", "molecular_viewer"] - - settings = collections.OrderedDict() - settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) - settings["frames"] = ( - "FramesConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["r_values"] = ( - "RangeConfigurator", - {"valueType": float, "includeLast": True, "mini": 0.0}, - ) - settings["q_values"] = ( - "RangeConfigurator", - {"valueType": float, "includeLast": True, "mini": 0.0}, - ) - settings["atom_selection"] = ( - "AtomSelectionConfigurator", - {"dependencies": {"trajectory": "trajectory"}}, - ) - settings["atom_transmutation"] = ( - "AtomTransmutationConfigurator", - { - "dependencies": { - "trajectory": "trajectory", - "atom_selection": "atom_selection", - } - }, - ) - settings["output_files"] = ( - "OutputFilesConfigurator", - {"formats": ["MDAFormat", "TextFormat"]}, - ) - settings["running_mode"] = ("RunningModeConfigurator", {}) - - def finalize(self): - """ - Finalizes the calculations (e.g. averaging the total term, output files creations ...). - """ - - nq = self.configuration["q_values"]["number"] - - nFrames = self.configuration["frames"]["number"] - - self.averageDensity /= nFrames - - densityFactor = 4.0 * np.pi * self.configuration["r_values"]["mid_points"] - - shellSurfaces = densityFactor * self.configuration["r_values"]["mid_points"] - - shellVolumes = shellSurfaces * self.configuration["r_values"]["step"] - - self._outputData.add( - "q", - "LineOutputVariable", - self.configuration["q_values"]["value"], - units="1/nm", - ) - - q = self._outputData["q"] - r = self.configuration["r_values"]["mid_points"] - - fact1 = 4.0 * np.pi * self.averageDensity - - sincqr = np.sinc(np.outer(q, r) / np.pi) - - dr = self.configuration["r_values"]["step"] - - nAtomsPerElement = self.configuration["atom_selection"].get_natoms() - for pair in self._elementsPairs: - self._outputData.add( - "xssf_intra_%s%s" % pair, - "LineOutputVariable", - (nq,), - axis="q", - units="au", - ) - self._outputData.add( - "xssf_inter_%s%s" % pair, - "LineOutputVariable", - (nq,), - axis="q", - units="au", - ) - self._outputData.add( - "xssf_total_%s%s" % pair, - "LineOutputVariable", - (nq,), - axis="q", - units="au", - ) - - ni = nAtomsPerElement[pair[0]] - nj = nAtomsPerElement[pair[1]] - - idi = self.selectedElements.index(pair[0]) - idj = self.selectedElements.index(pair[1]) - - if pair[0] == pair[1]: - nij = ni * (ni - 1) / 2.0 - else: - nij = ni * nj - self.hIntra[idi, idj] += self.hIntra[idj, idi] - self.hInter[idi, idj] += self.hInter[idj, idi] - - fact = nij * nFrames * shellVolumes - - pdfIntra = self.hIntra[idi, idj, :] / fact - pdfInter = self.hInter[idi, idj, :] / fact - - self._outputData["xssf_intra_%s%s" % pair][:] = ( - fact1 * np.sum((r**2) * pdfIntra * sincqr, axis=1) * dr - ) - self._outputData["xssf_inter_%s%s" % pair][:] = ( - 1.0 + fact1 * np.sum((r**2) * (pdfInter - 1.0) * sincqr, axis=1) * dr - ) - self._outputData["xssf_total_%s%s" % pair][:] = ( - self._outputData["xssf_intra_%s%s" % pair][:] - + self._outputData["xssf_inter_%s%s" % pair][:] - ) - - self._outputData.add( - "xssf_intra", "LineOutputVariable", (nq,), axis="q", units="au" - ) - self._outputData.add( - "xssf_inter", "LineOutputVariable", (nq,), axis="q", units="au" - ) - self._outputData.add( - "xssf_total", "LineOutputVariable", (nq,), axis="q", units="au" - ) - - asf = dict( - (k, atomic_scattering_factor(k, self._outputData["q"])) - for k in list(nAtomsPerElement.keys()) - ) - - xssfIntra = weight( - asf, self._outputData, nAtomsPerElement, 2, "xssf_intra_%s%s" - ) - self._outputData["xssf_intra"][:] = xssfIntra - - xssfInter = weight( - asf, self._outputData, nAtomsPerElement, 2, "xssf_inter_%s%s" - ) - self._outputData["xssf_inter"][:] = xssfInter - - self._outputData["xssf_total"][:] = xssfIntra + xssfInter - - self._outputData.write( - self.configuration["output_files"]["root"], - self.configuration["output_files"]["formats"], - self._info, - ) - - self.configuration["trajectory"]["instance"].close() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Chemistry import ATOMS_DATABASE +from MDANSE.Framework.Jobs.DistanceHistogram import DistanceHistogram +from MDANSE.Mathematics.Arithmetic import weight + + +def atomic_scattering_factor(element, qvalues): + a = np.empty((4,), dtype=np.float64) + a[0] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_a1") + a[1] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_a2") + a[2] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_a3") + a[3] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_a4") + + b = np.empty((4,), dtype=np.float64) + b[0] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_b1") + b[1] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_b2") + b[2] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_b3") + b[3] = ATOMS_DATABASE.get_atom_property(element, "xray_asf_b4") + + c = ATOMS_DATABASE.get_atom_property(element, "xray_asf_c") + + return c + np.sum( + a[:, np.newaxis] + * np.exp(-b[:, np.newaxis] * (qvalues[np.newaxis, :] / (4.0 * np.pi)) ** 2), + axis=0, + ) + + +class XRayStaticStructureFactor(DistanceHistogram): + """ + Computes the X-ray static structure from the pair distribution function for a set of atoms, + taking into account the atomic form factor for X-rays. + """ + + label = "XRay Static Structure Factor" + + enabled = True + + category = ( + "Analysis", + "Structure", + ) + + ancestor = ["hdf_trajectory", "molecular_viewer"] + + settings = collections.OrderedDict() + settings["trajectory"] = ("HDFTrajectoryConfigurator", {}) + settings["frames"] = ( + "FramesConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["r_values"] = ( + "RangeConfigurator", + {"valueType": float, "includeLast": True, "mini": 0.0}, + ) + settings["q_values"] = ( + "RangeConfigurator", + {"valueType": float, "includeLast": True, "mini": 0.0}, + ) + settings["atom_selection"] = ( + "AtomSelectionConfigurator", + {"dependencies": {"trajectory": "trajectory"}}, + ) + settings["atom_transmutation"] = ( + "AtomTransmutationConfigurator", + { + "dependencies": { + "trajectory": "trajectory", + "atom_selection": "atom_selection", + } + }, + ) + settings["output_files"] = ( + "OutputFilesConfigurator", + {"formats": ["MDAFormat", "TextFormat"]}, + ) + settings["running_mode"] = ("RunningModeConfigurator", {}) + + def finalize(self): + """ + Finalizes the calculations (e.g. averaging the total term, output files creations ...). + """ + + nq = self.configuration["q_values"]["number"] + + nFrames = self.configuration["frames"]["number"] + + self.averageDensity /= nFrames + + densityFactor = 4.0 * np.pi * self.configuration["r_values"]["mid_points"] + + shellSurfaces = densityFactor * self.configuration["r_values"]["mid_points"] + + shellVolumes = shellSurfaces * self.configuration["r_values"]["step"] + + self._outputData.add( + "q", + "LineOutputVariable", + self.configuration["q_values"]["value"], + units="1/nm", + ) + + q = self._outputData["q"] + r = self.configuration["r_values"]["mid_points"] + + fact1 = 4.0 * np.pi * self.averageDensity + + sincqr = np.sinc(np.outer(q, r) / np.pi) + + dr = self.configuration["r_values"]["step"] + + nAtomsPerElement = self.configuration["atom_selection"].get_natoms() + for pair in self._elementsPairs: + self._outputData.add( + "xssf_intra_%s%s" % pair, + "LineOutputVariable", + (nq,), + axis="q", + units="au", + ) + self._outputData.add( + "xssf_inter_%s%s" % pair, + "LineOutputVariable", + (nq,), + axis="q", + units="au", + ) + self._outputData.add( + "xssf_total_%s%s" % pair, + "LineOutputVariable", + (nq,), + axis="q", + units="au", + ) + + ni = nAtomsPerElement[pair[0]] + nj = nAtomsPerElement[pair[1]] + + idi = self.selectedElements.index(pair[0]) + idj = self.selectedElements.index(pair[1]) + + if pair[0] == pair[1]: + nij = ni * (ni - 1) / 2.0 + else: + nij = ni * nj + self.hIntra[idi, idj] += self.hIntra[idj, idi] + self.hInter[idi, idj] += self.hInter[idj, idi] + + fact = nij * nFrames * shellVolumes + + pdfIntra = self.hIntra[idi, idj, :] / fact + pdfInter = self.hInter[idi, idj, :] / fact + + self._outputData["xssf_intra_%s%s" % pair][:] = ( + fact1 * np.sum((r**2) * pdfIntra * sincqr, axis=1) * dr + ) + self._outputData["xssf_inter_%s%s" % pair][:] = ( + 1.0 + fact1 * np.sum((r**2) * (pdfInter - 1.0) * sincqr, axis=1) * dr + ) + self._outputData["xssf_total_%s%s" % pair][:] = ( + self._outputData["xssf_intra_%s%s" % pair][:] + + self._outputData["xssf_inter_%s%s" % pair][:] + ) + + self._outputData.add( + "xssf_intra", "LineOutputVariable", (nq,), axis="q", units="au" + ) + self._outputData.add( + "xssf_inter", "LineOutputVariable", (nq,), axis="q", units="au" + ) + self._outputData.add( + "xssf_total", "LineOutputVariable", (nq,), axis="q", units="au" + ) + + asf = dict( + (k, atomic_scattering_factor(k, self._outputData["q"])) + for k in list(nAtomsPerElement.keys()) + ) + + xssfIntra = weight( + asf, self._outputData, nAtomsPerElement, 2, "xssf_intra_%s%s" + ) + self._outputData["xssf_intra"][:] = xssfIntra + + xssfInter = weight( + asf, self._outputData, nAtomsPerElement, 2, "xssf_inter_%s%s" + ) + self._outputData["xssf_inter"][:] = xssfInter + + self._outputData["xssf_total"][:] = xssfIntra + xssfInter + + self._outputData.write( + self.configuration["output_files"]["root"], + self.configuration["output_files"]["formats"], + self._info, + ) + + self.configuration["trajectory"]["instance"].close() diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py b/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py index 52786fa95f..849ab4e315 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Jobs/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py index a299fd58ab..73f162441c 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/OutputVariables/IOutputVariable.py -# @brief Implements module/class/test IOutputVariable +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py index a8009ecd4c..26784c885c 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/OutputVariables/LineOutputVariable.py -# @brief Implements module/class/test LineOutputVariable +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py index 53cdadfdbf..b5784a8b7f 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/OutputVariables/SurfaceOutputVariable.py -# @brief Implements module/class/test SurfaceOutputVariable +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py index 7622d4835c..846fd441a1 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/OutputVariables/VolumeOutputVariable.py -# @brief Implements module/class/test VolumeOutputVariable +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py index 1eecc47bc9..d58dc5a672 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/OutputVariables/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py index f5f74a7cec..dbfa5dd3d9 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Projectors/AxialProjector.py -# @brief Implements module/class/test AxialProjector +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py index 4e7e9844ff..d220343364 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Projectors/IProjector.py -# @brief Implements module/class/test IProjector +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py index 5530f32c25..5d91219ade 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Projectors/NullProjector.py -# @brief Implements module/class/test NullProjector +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Projectors.IProjector import IProjector diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py index d5efc773ff..6aba720101 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Projectors/PlanarProjector.py -# @brief Implements module/class/test PlanarProjector +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py b/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py index cc10d24710..940f4739cd 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Projectors/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py index 39d78f099a..e34cb6987a 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py @@ -1,92 +1,96 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/ApproximateDispersionLatticeQVectors.py -# @brief Implements module/class/test ApproximateDispersionLatticeQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import itertools -import operator - -import numpy as np - -from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors - - -class ApproximateDispersionQVectors(LatticeQVectors): - """ """ - - settings = collections.OrderedDict() - settings["q_start"] = ( - "VectorConfigurator", - { - "label": "Q start (nm^-1)", - "valueType": float, - "notNull": False, - "default": [0, 0, 0], - }, - ) - settings["q_end"] = ( - "VectorConfigurator", - { - "label": "Q end (nm^-1)", - "valueType": float, - "notNull": False, - "default": [0, 0, 0], - }, - ) - settings["q_step"] = ( - "FloatConfigurator", - {"label": "Q step (nm^-1)", "mini": 1.0e-6, "default": 0.1}, - ) - - def _generate(self): - qStart = self._configuration["q_start"]["value"] - qEnd = self._configuration["q_end"]["value"] - qStep = self._configuration["q_step"]["value"] - - d = (qEnd - qStart).length() - - n = (qEnd - qStart).normal() - nSteps = int(d / qStep) + 1 - - vects = ( - np.array(qStart)[:, np.newaxis] + np.outer(n, np.arange(0, nSteps)) * qStep - ) - - hkls = np.rint(np.dot(self._directUnitCell, vects)) - - dists = np.sqrt(np.sum(vects**2, axis=0)) - dists = zip(range(len(dists)), dists) - dists.sort(key=operator.itemgetter(1)) - qGroups = itertools.groupby(dists, key=operator.itemgetter(1)) - qGroups = collections.OrderedDict( - [(k, [item[0] for item in v]) for k, v in qGroups] - ) - - if self._status is not None: - self._status.start(len(qGroups)) - - self._configuration["q_vectors"] = collections.OrderedDict() - - for k, v in qGroups.items(): - self._configuration["q_vectors"][k] = {} - self._configuration["q_vectors"][k]["q"] = k - self._configuration["q_vectors"][k]["q_vectors"] = vects[:, v] - self._configuration["q_vectors"][k]["n_q_vectors"] = len(v) - self._configuration["q_vectors"][k]["hkls"] = hkls[:, v] - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import itertools +import operator + +import numpy as np + +from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors + + +class ApproximateDispersionQVectors(LatticeQVectors): + """ """ + + settings = collections.OrderedDict() + settings["q_start"] = ( + "VectorConfigurator", + { + "label": "Q start (nm^-1)", + "valueType": float, + "notNull": False, + "default": [0, 0, 0], + }, + ) + settings["q_end"] = ( + "VectorConfigurator", + { + "label": "Q end (nm^-1)", + "valueType": float, + "notNull": False, + "default": [0, 0, 0], + }, + ) + settings["q_step"] = ( + "FloatConfigurator", + {"label": "Q step (nm^-1)", "mini": 1.0e-6, "default": 0.1}, + ) + + def _generate(self): + qStart = self._configuration["q_start"]["value"] + qEnd = self._configuration["q_end"]["value"] + qStep = self._configuration["q_step"]["value"] + + d = (qEnd - qStart).length() + + n = (qEnd - qStart).normal() + nSteps = int(d / qStep) + 1 + + vects = ( + np.array(qStart)[:, np.newaxis] + np.outer(n, np.arange(0, nSteps)) * qStep + ) + + hkls = np.rint(np.dot(self._directUnitCell, vects)) + + dists = np.sqrt(np.sum(vects**2, axis=0)) + dists = zip(range(len(dists)), dists) + dists.sort(key=operator.itemgetter(1)) + qGroups = itertools.groupby(dists, key=operator.itemgetter(1)) + qGroups = collections.OrderedDict( + [(k, [item[0] for item in v]) for k, v in qGroups] + ) + + if self._status is not None: + self._status.start(len(qGroups)) + + self._configuration["q_vectors"] = collections.OrderedDict() + + for k, v in qGroups.items(): + self._configuration["q_vectors"][k] = {} + self._configuration["q_vectors"][k]["q"] = k + self._configuration["q_vectors"][k]["q_vectors"] = vects[:, v] + self._configuration["q_vectors"][k]["n_q_vectors"] = len(v) + self._configuration["q_vectors"][k]["hkls"] = hkls[:, v] + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py index 93709c0f5e..cf58ea40f8 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py @@ -1,122 +1,126 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/CircularLatticeQVectors.py -# @brief Implements module/class/test CircularLatticeQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import random - -import numpy as np - -from MDANSE.Mathematics.LinearAlgebra import Vector - -from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors - - -class CircularLatticeQVectors(LatticeQVectors): - """ """ - - settings = collections.OrderedDict() - settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) - settings["shells"] = ( - "RangeConfigurator", - { - "valueType": float, - "includeLast": True, - "mini": 0.0, - "default": (0.0, 5.0, 0.5), - }, - ) - settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) - settings["width"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 1.0}) - settings["axis_1"] = ( - "VectorConfigurator", - {"normalize": False, "notNull": True, "valueType": int, "default": [1, 0, 0]}, - ) - settings["axis_2"] = ( - "VectorConfigurator", - {"normalize": False, "notNull": True, "valueType": int, "default": [0, 1, 0]}, - ) - - def _generate(self): - if self._configuration["seed"]["value"] != 0: - np.random.seed(self._configuration["seed"]["value"]) - random.seed(self._configuration["seed"]["value"]) - - hkls = np.transpose( - [ - self._configuration["axis_1"]["vector"], - self._configuration["axis_2"]["vector"], - ] - ) - - qVects = np.dot(self._inverseUnitCell, hkls) - - qMax = ( - self._configuration["shells"]["last"] - + 0.5 * self._configuration["width"]["value"] - ) - - uvMax = np.ceil([qMax / Vector(v).length() for v in qVects.T]) + 1 - # Enforce integers in uvMax - uvMax = uvMax.astype(np.int64) - - idxs = np.mgrid[-uvMax[0] : uvMax[0] + 1, -uvMax[1] : uvMax[1] + 1] - - idxs = idxs.reshape(2, (2 * uvMax[0] + 1) * (2 * uvMax[1] + 1)) - - vects = np.dot(qVects, idxs) - - dists2 = np.sum(vects**2, axis=0) - - halfWidth = self._configuration["width"]["value"] / 2 - - nVectors = self._configuration["n_vectors"]["value"] - - if self._status is not None: - self._status.start(self._configuration["shells"]["number"]) - - self._configuration["q_vectors"] = collections.OrderedDict() - - for q in self._configuration["shells"]["value"]: - qmin = max(0, q - halfWidth) - - q2low = qmin * qmin - q2up = (q + halfWidth) * (q + halfWidth) - - hits = np.where((dists2 >= q2low) & (dists2 <= q2up))[0] - - nHits = len(hits) - - if nHits != 0: - n = min(nHits, nVectors) - - if nHits > nVectors: - hits = random.sample(hits, nVectors) - - self._configuration["q_vectors"][q] = {} - self._configuration["q_vectors"][q]["q_vectors"] = vects[:, hits] - self._configuration["q_vectors"][q]["n_q_vectors"] = n - self._configuration["q_vectors"][q]["q"] = q - self._configuration["q_vectors"][q]["hkls"] = np.rint( - np.dot( - self._directUnitCell, - self._configuration["q_vectors"][q]["q_vectors"], - ) - ) - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import random + +import numpy as np + +from MDANSE.Mathematics.LinearAlgebra import Vector + +from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors + + +class CircularLatticeQVectors(LatticeQVectors): + """ """ + + settings = collections.OrderedDict() + settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) + settings["shells"] = ( + "RangeConfigurator", + { + "valueType": float, + "includeLast": True, + "mini": 0.0, + "default": (0.0, 5.0, 0.5), + }, + ) + settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) + settings["width"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 1.0}) + settings["axis_1"] = ( + "VectorConfigurator", + {"normalize": False, "notNull": True, "valueType": int, "default": [1, 0, 0]}, + ) + settings["axis_2"] = ( + "VectorConfigurator", + {"normalize": False, "notNull": True, "valueType": int, "default": [0, 1, 0]}, + ) + + def _generate(self): + if self._configuration["seed"]["value"] != 0: + np.random.seed(self._configuration["seed"]["value"]) + random.seed(self._configuration["seed"]["value"]) + + hkls = np.transpose( + [ + self._configuration["axis_1"]["vector"], + self._configuration["axis_2"]["vector"], + ] + ) + + qVects = np.dot(self._inverseUnitCell, hkls) + + qMax = ( + self._configuration["shells"]["last"] + + 0.5 * self._configuration["width"]["value"] + ) + + uvMax = np.ceil([qMax / Vector(v).length() for v in qVects.T]) + 1 + # Enforce integers in uvMax + uvMax = uvMax.astype(np.int64) + + idxs = np.mgrid[-uvMax[0] : uvMax[0] + 1, -uvMax[1] : uvMax[1] + 1] + + idxs = idxs.reshape(2, (2 * uvMax[0] + 1) * (2 * uvMax[1] + 1)) + + vects = np.dot(qVects, idxs) + + dists2 = np.sum(vects**2, axis=0) + + halfWidth = self._configuration["width"]["value"] / 2 + + nVectors = self._configuration["n_vectors"]["value"] + + if self._status is not None: + self._status.start(self._configuration["shells"]["number"]) + + self._configuration["q_vectors"] = collections.OrderedDict() + + for q in self._configuration["shells"]["value"]: + qmin = max(0, q - halfWidth) + + q2low = qmin * qmin + q2up = (q + halfWidth) * (q + halfWidth) + + hits = np.where((dists2 >= q2low) & (dists2 <= q2up))[0] + + nHits = len(hits) + + if nHits != 0: + n = min(nHits, nVectors) + + if nHits > nVectors: + hits = random.sample(hits, nVectors) + + self._configuration["q_vectors"][q] = {} + self._configuration["q_vectors"][q]["q_vectors"] = vects[:, hits] + self._configuration["q_vectors"][q]["n_q_vectors"] = n + self._configuration["q_vectors"][q]["q"] = q + self._configuration["q_vectors"][q]["hkls"] = np.rint( + np.dot( + self._directUnitCell, + self._configuration["q_vectors"][q]["q_vectors"], + ) + ) + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py index 3a7415d459..3fecead344 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py @@ -1,87 +1,91 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/CircularQVectors.py -# @brief Implements module/class/test CircularQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Framework.QVectors.IQVectors import IQVectors, QVectorsError -from MDANSE.Mathematics.Geometry import random_points_on_circle - - -class CircularQVectors(IQVectors): - """ """ - - settings = collections.OrderedDict() - settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) - settings["shells"] = ( - "RangeConfigurator", - { - "valueType": float, - "includeLast": True, - "mini": 0.0, - "default": (0.0, 5.0, 0.5), - }, - ) - settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) - settings["width"] = ("FloatConfigurator", {"mini": 0.0, "default": 1.0}) - settings["axis_1"] = ( - "VectorConfigurator", - {"normalize": True, "notNull": True, "default": [1, 0, 0], "valueType": float}, - ) - settings["axis_2"] = ( - "VectorConfigurator", - {"normalize": True, "notNull": True, "default": [0, 1, 0], "valueType": float}, - ) - - def _generate(self): - if self._configuration["seed"]["value"] != 0: - np.random.seed(self._configuration["seed"]["value"]) - - try: - axis = ( - self._configuration["axis_1"]["vector"] - .cross(self._configuration["axis_2"]["vector"]) - .normal() - ) - except ZeroDivisionError as e: - raise QVectorsError(str(e)) - - width = self._configuration["width"]["value"] - - nVectors = self._configuration["n_vectors"]["value"] - - if self._status is not None: - self._status.start(self._configuration["shells"]["number"]) - - self._configuration["q_vectors"] = collections.OrderedDict() - - for q in self._configuration["shells"]["value"]: - fact = q * np.sign( - np.random.uniform(-0.5, 0.5, nVectors) - ) + width * np.random.uniform(-0.5, 0.5, nVectors) - v = random_points_on_circle(axis, radius=1.0, nPoints=nVectors) - - self._configuration["q_vectors"][q] = {} - self._configuration["q_vectors"][q]["q_vectors"] = fact * v - self._configuration["q_vectors"][q]["n_q_vectors"] = nVectors - self._configuration["q_vectors"][q]["q"] = q - self._configuration["q_vectors"][q]["hkls"] = None - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Framework.QVectors.IQVectors import IQVectors, QVectorsError +from MDANSE.Mathematics.Geometry import random_points_on_circle + + +class CircularQVectors(IQVectors): + """ """ + + settings = collections.OrderedDict() + settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) + settings["shells"] = ( + "RangeConfigurator", + { + "valueType": float, + "includeLast": True, + "mini": 0.0, + "default": (0.0, 5.0, 0.5), + }, + ) + settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) + settings["width"] = ("FloatConfigurator", {"mini": 0.0, "default": 1.0}) + settings["axis_1"] = ( + "VectorConfigurator", + {"normalize": True, "notNull": True, "default": [1, 0, 0], "valueType": float}, + ) + settings["axis_2"] = ( + "VectorConfigurator", + {"normalize": True, "notNull": True, "default": [0, 1, 0], "valueType": float}, + ) + + def _generate(self): + if self._configuration["seed"]["value"] != 0: + np.random.seed(self._configuration["seed"]["value"]) + + try: + axis = ( + self._configuration["axis_1"]["vector"] + .cross(self._configuration["axis_2"]["vector"]) + .normal() + ) + except ZeroDivisionError as e: + raise QVectorsError(str(e)) + + width = self._configuration["width"]["value"] + + nVectors = self._configuration["n_vectors"]["value"] + + if self._status is not None: + self._status.start(self._configuration["shells"]["number"]) + + self._configuration["q_vectors"] = collections.OrderedDict() + + for q in self._configuration["shells"]["value"]: + fact = q * np.sign( + np.random.uniform(-0.5, 0.5, nVectors) + ) + width * np.random.uniform(-0.5, 0.5, nVectors) + v = random_points_on_circle(axis, radius=1.0, nPoints=nVectors) + + self._configuration["q_vectors"][q] = {} + self._configuration["q_vectors"][q]["q_vectors"] = fact * v + self._configuration["q_vectors"][q]["n_q_vectors"] = nVectors + self._configuration["q_vectors"][q]["q"] = q + self._configuration["q_vectors"][q]["hkls"] = None + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py index 94ad68b89b..e100310265 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py @@ -1,72 +1,76 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/DispersionLatticeQVectors.py -# @brief Implements module/class/test DispersionLatticeQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors - - -class DispersionLatticeQVectors(LatticeQVectors): - """ """ - - settings = collections.OrderedDict() - settings["start"] = ( - "VectorConfigurator", - {"valueType": int, "notNull": False, "default": [0, 0, 0]}, - ) - settings["direction"] = ( - "VectorConfigurator", - {"valueType": int, "notNull": True, "default": [1, 0, 0]}, - ) - settings["n_steps"] = ( - "IntegerConfigurator", - {"label": "number of steps", "mini": 1, "default": 10}, - ) - - def _generate(self): - start = self._configuration["start"]["value"] - direction = self._configuration["direction"]["value"] - n_steps = self._configuration["n_steps"]["value"] - - hkls = np.array(start)[:, np.newaxis] + np.outer( - direction, np.arange(0, n_steps) - ) - - # The k matrix (3,n_hkls) - vects = np.dot(self._inverseUnitCell, hkls) - - dists = np.sqrt(np.sum(vects**2, axis=0)) - - if self._status is not None: - self._status.start(len(dists)) - - self._configuration["q_vectors"] = collections.OrderedDict() - - for i, v in enumerate(dists): - self._configuration["q_vectors"][v] = {} - self._configuration["q_vectors"][v]["q_vectors"] = vects[:, i][ - :, np.newaxis - ] - self._configuration["q_vectors"][v]["n_q_vectors"] = 1 - self._configuration["q_vectors"][v]["q"] = v - self._configuration["q_vectors"][v]["hkls"] = hkls[:, i][:, np.newaxis] - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors + + +class DispersionLatticeQVectors(LatticeQVectors): + """ """ + + settings = collections.OrderedDict() + settings["start"] = ( + "VectorConfigurator", + {"valueType": int, "notNull": False, "default": [0, 0, 0]}, + ) + settings["direction"] = ( + "VectorConfigurator", + {"valueType": int, "notNull": True, "default": [1, 0, 0]}, + ) + settings["n_steps"] = ( + "IntegerConfigurator", + {"label": "number of steps", "mini": 1, "default": 10}, + ) + + def _generate(self): + start = self._configuration["start"]["value"] + direction = self._configuration["direction"]["value"] + n_steps = self._configuration["n_steps"]["value"] + + hkls = np.array(start)[:, np.newaxis] + np.outer( + direction, np.arange(0, n_steps) + ) + + # The k matrix (3,n_hkls) + vects = np.dot(self._inverseUnitCell, hkls) + + dists = np.sqrt(np.sum(vects**2, axis=0)) + + if self._status is not None: + self._status.start(len(dists)) + + self._configuration["q_vectors"] = collections.OrderedDict() + + for i, v in enumerate(dists): + self._configuration["q_vectors"][v] = {} + self._configuration["q_vectors"][v]["q_vectors"] = vects[:, i][ + :, np.newaxis + ] + self._configuration["q_vectors"][v]["n_q_vectors"] = 1 + self._configuration["q_vectors"][v]["q"] = v + self._configuration["q_vectors"][v]["hkls"] = hkls[:, i][:, np.newaxis] + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py index 0b806a0a8c..5ab51785d3 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py @@ -1,96 +1,100 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/GridQVectors.py -# @brief Implements module/class/test GridQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import itertools -import operator - -import numpy as np - -from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors - - -class GridQVectors(LatticeQVectors): - """ """ - - settings = collections.OrderedDict() - settings["hrange"] = ( - "RangeConfigurator", - {"valueType": int, "includeLast": True, "default": (0, 8, 1)}, - ) - settings["krange"] = ( - "RangeConfigurator", - {"valueType": int, "includeLast": True, "default": (0, 8, 1)}, - ) - settings["lrange"] = ( - "RangeConfigurator", - {"valueType": int, "includeLast": True, "default": (0, 8, 1)}, - ) - settings["qstep"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 0.01}) - - def _generate(self): - hrange = self._configuration["hrange"]["value"] - krange = self._configuration["krange"]["value"] - lrange = self._configuration["krange"]["value"] - qstep = self._configuration["qstep"]["value"] - - nh = self._configuration["hrange"]["number"] - nk = self._configuration["krange"]["number"] - nl = self._configuration["lrange"]["number"] - - hkls = np.mgrid[ - hrange[0] : hrange[-1] + 1, - krange[0] : krange[-1] + 1, - lrange[0] : lrange[-1] + 1, - ] - hkls = hkls.reshape(3, nh * nk * nl) - - # The k matrix (3,n_hkls) - vects = np.dot(self._inverseUnitCell, hkls) - - dists = np.sqrt(np.sum(vects**2, axis=0)) - - minDist = dists.min() - maxDist = dists.max() - - bins = np.arange(minDist, maxDist + qstep / 2, qstep) - inds = np.digitize(dists, bins) - 1 - - dists = bins[inds] - - dists = zip(range(len(dists)), dists) - dists.sort(key=operator.itemgetter(1)) - qGroups = itertools.groupby(dists, key=operator.itemgetter(1)) - qGroups = collections.OrderedDict( - [(k, [item[0] for item in v]) for k, v in qGroups] - ) - - if self._status is not None: - self._status.start(len(qGroups)) - - self._configuration["q_vectors"] = collections.OrderedDict() - - for q, v in qGroups.items(): - self._configuration["q_vectors"][q] = {} - self._configuration["q_vectors"][q]["q"] = q - self._configuration["q_vectors"][q]["q_vectors"] = vects[:, v] - self._configuration["q_vectors"][q]["n_q_vectors"] = len(v) - self._configuration["q_vectors"][q]["hkls"] = hkls[:, v] - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import itertools +import operator + +import numpy as np + +from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors + + +class GridQVectors(LatticeQVectors): + """ """ + + settings = collections.OrderedDict() + settings["hrange"] = ( + "RangeConfigurator", + {"valueType": int, "includeLast": True, "default": (0, 8, 1)}, + ) + settings["krange"] = ( + "RangeConfigurator", + {"valueType": int, "includeLast": True, "default": (0, 8, 1)}, + ) + settings["lrange"] = ( + "RangeConfigurator", + {"valueType": int, "includeLast": True, "default": (0, 8, 1)}, + ) + settings["qstep"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 0.01}) + + def _generate(self): + hrange = self._configuration["hrange"]["value"] + krange = self._configuration["krange"]["value"] + lrange = self._configuration["krange"]["value"] + qstep = self._configuration["qstep"]["value"] + + nh = self._configuration["hrange"]["number"] + nk = self._configuration["krange"]["number"] + nl = self._configuration["lrange"]["number"] + + hkls = np.mgrid[ + hrange[0] : hrange[-1] + 1, + krange[0] : krange[-1] + 1, + lrange[0] : lrange[-1] + 1, + ] + hkls = hkls.reshape(3, nh * nk * nl) + + # The k matrix (3,n_hkls) + vects = np.dot(self._inverseUnitCell, hkls) + + dists = np.sqrt(np.sum(vects**2, axis=0)) + + minDist = dists.min() + maxDist = dists.max() + + bins = np.arange(minDist, maxDist + qstep / 2, qstep) + inds = np.digitize(dists, bins) - 1 + + dists = bins[inds] + + dists = zip(range(len(dists)), dists) + dists.sort(key=operator.itemgetter(1)) + qGroups = itertools.groupby(dists, key=operator.itemgetter(1)) + qGroups = collections.OrderedDict( + [(k, [item[0] for item in v]) for k, v in qGroups] + ) + + if self._status is not None: + self._status.start(len(qGroups)) + + self._configuration["q_vectors"] = collections.OrderedDict() + + for q, v in qGroups.items(): + self._configuration["q_vectors"][q] = {} + self._configuration["q_vectors"][q]["q"] = q + self._configuration["q_vectors"][q]["q_vectors"] = vects[:, v] + self._configuration["q_vectors"][q]["n_q_vectors"] = len(v) + self._configuration["q_vectors"][q]["hkls"] = hkls[:, v] + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py index 2bcd2e6bb8..227956d4df 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py @@ -1,49 +1,53 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/IQVectors.py -# @brief Implements module/class/test IQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import abc - -from MDANSE.Core.Error import Error -from MDANSE.Framework.Configurable import Configurable - -from MDANSE.Core.SubclassFactory import SubclassFactory - - -class QVectorsError(Error): - pass - - -class IQVectors(Configurable, metaclass=SubclassFactory): - is_lattice = False - - def __init__(self, chemical_system, status=None): - Configurable.__init__(self) - - self._chemical_system = chemical_system - - self._status = status - - @abc.abstractmethod - def _generate(self): - pass - - def generate(self): - self._generate() - - if self._status is not None: - self._status.finish() - - def setStatus(self, status): - self._status = status +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import abc + +from MDANSE.Core.Error import Error +from MDANSE.Framework.Configurable import Configurable + +from MDANSE.Core.SubclassFactory import SubclassFactory + + +class QVectorsError(Error): + pass + + +class IQVectors(Configurable, metaclass=SubclassFactory): + is_lattice = False + + def __init__(self, chemical_system, status=None): + Configurable.__init__(self) + + self._chemical_system = chemical_system + + self._status = status + + @abc.abstractmethod + def _generate(self): + pass + + def generate(self): + self._generate() + + if self._status is not None: + self._status.finish() + + def setStatus(self, status): + self._status = status diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py index d63c3448e6..5a52f0fa9b 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py @@ -1,41 +1,45 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/LatticeQvectors.py -# @brief Implements module/class/test LatticeQvectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import numpy as np - -from MDANSE.Framework.QVectors.IQVectors import IQVectors, QVectorsError - - -class LatticeQVectors(IQVectors): - is_lattice = True - - def __init__(self, chemical_system, status=None): - super(LatticeQVectors, self).__init__(chemical_system, status) - - if self._chemical_system.configuration is None: - raise QVectorsError("No configuration set for the chemical system") - - if not self._chemical_system.configuration.is_periodic: - raise QVectorsError( - "The universe must be periodic for building lattice-based Q vectors" - ) - - self._inverseUnitCell = ( - 2.0 * np.pi * self._chemical_system.configuration.unit_cell.inverse - ) - - self._directUnitCell = ( - 2.0 * np.pi * self._chemical_system.configuration.unit_cell.direct - ) +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import numpy as np + +from MDANSE.Framework.QVectors.IQVectors import IQVectors, QVectorsError + + +class LatticeQVectors(IQVectors): + is_lattice = True + + def __init__(self, chemical_system, status=None): + super(LatticeQVectors, self).__init__(chemical_system, status) + + if self._chemical_system.configuration is None: + raise QVectorsError("No configuration set for the chemical system") + + if not self._chemical_system.configuration.is_periodic: + raise QVectorsError( + "The universe must be periodic for building lattice-based Q vectors" + ) + + self._inverseUnitCell = ( + 2.0 * np.pi * self._chemical_system.configuration.unit_cell.inverse + ) + + self._directUnitCell = ( + 2.0 * np.pi * self._chemical_system.configuration.unit_cell.direct + ) diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py index f9c97806ff..ad0883d06f 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py @@ -1,108 +1,112 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/LinearLatticeQVectors.py -# @brief Implements module/class/test LinearLatticeQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections -import random - -import numpy as np - -from MDANSE.Mathematics.LinearAlgebra import Vector - -from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors - - -class LinearLatticeQVectors(LatticeQVectors): - """ """ - - settings = collections.OrderedDict() - settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) - settings["shells"] = ( - "RangeConfigurator", - { - "valueType": float, - "includeLast": True, - "mini": 0.0, - "default": (0, 5.0, 0.5), - }, - ) - settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) - settings["width"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 1.0}) - settings["axis"] = ( - "VectorConfigurator", - {"normalize": False, "notNull": True, "valueType": int, "default": [1, 0, 0]}, - ) - - def _generate(self): - if self._configuration["seed"]["value"] != 0: - np.random.seed(self._configuration["seed"]["value"]) - random.seed(self._configuration["seed"]["value"]) - - # The Q vector corresponding to the input hkl. - qVect = np.dot(self._inverseUnitCell, self._configuration["axis"]["vector"]) - - qMax = ( - self._configuration["shells"]["last"] - + 0.5 * self._configuration["width"]["value"] - ) - - uMax = np.ceil(qMax / Vector(qVect).length()) + 1 - - idxs = np.mgrid[-uMax : uMax + 1] - - vects = np.dot(qVect[:, np.newaxis], idxs[np.newaxis, :]) - - dists2 = np.sum(vects**2, axis=0) - - halfWidth = self._configuration["width"]["value"] / 2 - - nVectors = self._configuration["n_vectors"]["value"] - - if self._status is not None: - self._status.start(self._configuration["shells"]["number"]) - - self._configuration["q_vectors"] = collections.OrderedDict() - - for q in self._configuration["shells"]["value"]: - qmin = max(0, q - halfWidth) - - q2low = qmin * qmin - q2up = (q + halfWidth) * (q + halfWidth) - - hits = np.where((dists2 >= q2low) & (dists2 <= q2up))[0] - - nHits = len(hits) - - if nHits != 0: - n = min(nHits, nVectors) - - if nHits > nVectors: - hits = random.sample(hits, nVectors) - - self._configuration["q_vectors"][q] = {} - self._configuration["q_vectors"][q]["q_vectors"] = vects[:, hits] - self._configuration["q_vectors"][q]["n_q_vectors"] = n - self._configuration["q_vectors"][q]["q"] = q - self._configuration["q_vectors"][q]["hkls"] = np.rint( - np.dot( - self._directUnitCell, - self._configuration["q_vectors"][q]["q_vectors"], - ) - ) - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections +import random + +import numpy as np + +from MDANSE.Mathematics.LinearAlgebra import Vector + +from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors + + +class LinearLatticeQVectors(LatticeQVectors): + """ """ + + settings = collections.OrderedDict() + settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) + settings["shells"] = ( + "RangeConfigurator", + { + "valueType": float, + "includeLast": True, + "mini": 0.0, + "default": (0, 5.0, 0.5), + }, + ) + settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) + settings["width"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 1.0}) + settings["axis"] = ( + "VectorConfigurator", + {"normalize": False, "notNull": True, "valueType": int, "default": [1, 0, 0]}, + ) + + def _generate(self): + if self._configuration["seed"]["value"] != 0: + np.random.seed(self._configuration["seed"]["value"]) + random.seed(self._configuration["seed"]["value"]) + + # The Q vector corresponding to the input hkl. + qVect = np.dot(self._inverseUnitCell, self._configuration["axis"]["vector"]) + + qMax = ( + self._configuration["shells"]["last"] + + 0.5 * self._configuration["width"]["value"] + ) + + uMax = np.ceil(qMax / Vector(qVect).length()) + 1 + + idxs = np.mgrid[-uMax : uMax + 1] + + vects = np.dot(qVect[:, np.newaxis], idxs[np.newaxis, :]) + + dists2 = np.sum(vects**2, axis=0) + + halfWidth = self._configuration["width"]["value"] / 2 + + nVectors = self._configuration["n_vectors"]["value"] + + if self._status is not None: + self._status.start(self._configuration["shells"]["number"]) + + self._configuration["q_vectors"] = collections.OrderedDict() + + for q in self._configuration["shells"]["value"]: + qmin = max(0, q - halfWidth) + + q2low = qmin * qmin + q2up = (q + halfWidth) * (q + halfWidth) + + hits = np.where((dists2 >= q2low) & (dists2 <= q2up))[0] + + nHits = len(hits) + + if nHits != 0: + n = min(nHits, nVectors) + + if nHits > nVectors: + hits = random.sample(hits, nVectors) + + self._configuration["q_vectors"][q] = {} + self._configuration["q_vectors"][q]["q_vectors"] = vects[:, hits] + self._configuration["q_vectors"][q]["n_q_vectors"] = n + self._configuration["q_vectors"][q]["q"] = q + self._configuration["q_vectors"][q]["hkls"] = np.rint( + np.dot( + self._directUnitCell, + self._configuration["q_vectors"][q]["q_vectors"], + ) + ) + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py index 21e40fb37c..7c957132f6 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py @@ -1,76 +1,80 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/LinearQVectors.py -# @brief Implements module/class/test LinearQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Framework.QVectors.IQVectors import IQVectors - - -class LinearQVectors(IQVectors): - """ """ - - settings = collections.OrderedDict() - settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) - settings["shells"] = ( - "RangeConfigurator", - { - "valueType": float, - "includeLast": True, - "mini": 0.0, - "default": (0, 5.0, 0.5), - }, - ) - settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) - settings["width"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 1.0}) - settings["axis"] = ( - "VectorConfigurator", - {"normalize": True, "notNull": True, "default": [1, 0, 0], "valueType": float}, - ) - - def _generate(self): - if self._configuration["seed"]["value"] != 0: - np.random.seed(self._configuration["seed"]["value"]) - - axis = self._configuration["axis"]["vector"] - - width = self._configuration["width"]["value"] - - nVectors = self._configuration["n_vectors"]["value"] - - if self._status is not None: - self._status.start(self._configuration["shells"]["number"]) - - self._configuration["q_vectors"] = collections.OrderedDict() - - for q in self._configuration["shells"]["value"]: - fact = q * np.sign( - np.random.uniform(-0.5, 0.5, nVectors) - ) + width * np.random.uniform(-0.5, 0.5, nVectors) - - self._configuration["q_vectors"][q] = {} - self._configuration["q_vectors"][q]["q_vectors"] = ( - axis.array[:, np.newaxis] * fact - ) - self._configuration["q_vectors"][q]["n_q_vectors"] = nVectors - self._configuration["q_vectors"][q]["q"] = q - self._configuration["q_vectors"][q]["hkls"] = None - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Framework.QVectors.IQVectors import IQVectors + + +class LinearQVectors(IQVectors): + """ """ + + settings = collections.OrderedDict() + settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) + settings["shells"] = ( + "RangeConfigurator", + { + "valueType": float, + "includeLast": True, + "mini": 0.0, + "default": (0, 5.0, 0.5), + }, + ) + settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) + settings["width"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 1.0}) + settings["axis"] = ( + "VectorConfigurator", + {"normalize": True, "notNull": True, "default": [1, 0, 0], "valueType": float}, + ) + + def _generate(self): + if self._configuration["seed"]["value"] != 0: + np.random.seed(self._configuration["seed"]["value"]) + + axis = self._configuration["axis"]["vector"] + + width = self._configuration["width"]["value"] + + nVectors = self._configuration["n_vectors"]["value"] + + if self._status is not None: + self._status.start(self._configuration["shells"]["number"]) + + self._configuration["q_vectors"] = collections.OrderedDict() + + for q in self._configuration["shells"]["value"]: + fact = q * np.sign( + np.random.uniform(-0.5, 0.5, nVectors) + ) + width * np.random.uniform(-0.5, 0.5, nVectors) + + self._configuration["q_vectors"][q] = {} + self._configuration["q_vectors"][q]["q_vectors"] = ( + axis.array[:, np.newaxis] * fact + ) + self._configuration["q_vectors"][q]["n_q_vectors"] = nVectors + self._configuration["q_vectors"][q]["q"] = q + self._configuration["q_vectors"][q]["hkls"] = None + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py index 2a940869dd..fbf997f777 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py @@ -1,109 +1,113 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/MillerIndicesQVectors.py -# @brief Implements module/class/test MillerIndicesQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors - - -class MillerIndicesQVectors(LatticeQVectors): - """ """ - - settings = collections.OrderedDict() - settings["shells"] = ( - "RangeConfigurator", - { - "valueType": float, - "includeLast": True, - "mini": 0.0, - "default": (0, 5.0, 0.5), - }, - ) - settings["width"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 1.0}) - settings["h"] = ( - "RangeConfigurator", - {"includeLast": True, "default": (0, 8, 1), "valueType": int}, - ) - settings["k"] = ( - "RangeConfigurator", - {"includeLast": True, "default": (0, 8, 1), "valueType": int}, - ) - settings["l"] = ( - "RangeConfigurator", - {"includeLast": True, "default": (0, 8, 1), "valueType": int}, - ) - - def _generate(self): - hSlice = slice( - self._configuration["h"]["first"], - self._configuration["h"]["last"] + 1, - self._configuration["h"]["step"], - ) - kSlice = slice( - self._configuration["k"]["first"], - self._configuration["k"]["last"] + 1, - self._configuration["k"]["step"], - ) - lSlice = slice( - self._configuration["l"]["first"], - self._configuration["l"]["last"] + 1, - self._configuration["l"]["step"], - ) - - # The hkl matrix (3,n_hkls) - hkls = np.mgrid[hSlice, kSlice, lSlice] - hkls = hkls.reshape(3, hkls.size / 3) - - # The k matrix (3,n_hkls) - vects = np.dot(self._inverseUnitCell, hkls) - - dists2 = np.sum(vects**2, axis=0) - - halfWidth = self._configuration["width"]["value"] / 2 - - if self._status is not None: - self._status.start(len(self._configuration["shells"]["value"])) - - self._configuration["q_vectors"] = collections.OrderedDict() - - for q in self._configuration["shells"]["value"]: - qmin = max(0, q - halfWidth) - - q2low = qmin * qmin - q2up = (q + halfWidth) * (q + halfWidth) - - hits = np.where((dists2 >= q2low) & (dists2 <= q2up))[0] - - nHits = len(hits) - - if nHits != 0: - self._configuration["q_vectors"][q] = {} - self._configuration["q_vectors"][q]["q_vectors"] = vects[:, hits] - self._configuration["q_vectors"][q]["n_q_vectors"] = nHits - self._configuration["q_vectors"][q]["q"] = q - self._configuration["q_vectors"][q]["hkls"] = np.rint( - np.dot( - self._directUnitCell, - self._configuration["q_vectors"][q]["q_vectors"], - ) - ) - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Framework.QVectors.LatticeQVectors import LatticeQVectors + + +class MillerIndicesQVectors(LatticeQVectors): + """ """ + + settings = collections.OrderedDict() + settings["shells"] = ( + "RangeConfigurator", + { + "valueType": float, + "includeLast": True, + "mini": 0.0, + "default": (0, 5.0, 0.5), + }, + ) + settings["width"] = ("FloatConfigurator", {"mini": 1.0e-6, "default": 1.0}) + settings["h"] = ( + "RangeConfigurator", + {"includeLast": True, "default": (0, 8, 1), "valueType": int}, + ) + settings["k"] = ( + "RangeConfigurator", + {"includeLast": True, "default": (0, 8, 1), "valueType": int}, + ) + settings["l"] = ( + "RangeConfigurator", + {"includeLast": True, "default": (0, 8, 1), "valueType": int}, + ) + + def _generate(self): + hSlice = slice( + self._configuration["h"]["first"], + self._configuration["h"]["last"] + 1, + self._configuration["h"]["step"], + ) + kSlice = slice( + self._configuration["k"]["first"], + self._configuration["k"]["last"] + 1, + self._configuration["k"]["step"], + ) + lSlice = slice( + self._configuration["l"]["first"], + self._configuration["l"]["last"] + 1, + self._configuration["l"]["step"], + ) + + # The hkl matrix (3,n_hkls) + hkls = np.mgrid[hSlice, kSlice, lSlice] + hkls = hkls.reshape(3, hkls.size / 3) + + # The k matrix (3,n_hkls) + vects = np.dot(self._inverseUnitCell, hkls) + + dists2 = np.sum(vects**2, axis=0) + + halfWidth = self._configuration["width"]["value"] / 2 + + if self._status is not None: + self._status.start(len(self._configuration["shells"]["value"])) + + self._configuration["q_vectors"] = collections.OrderedDict() + + for q in self._configuration["shells"]["value"]: + qmin = max(0, q - halfWidth) + + q2low = qmin * qmin + q2up = (q + halfWidth) * (q + halfWidth) + + hits = np.where((dists2 >= q2low) & (dists2 <= q2up))[0] + + nHits = len(hits) + + if nHits != 0: + self._configuration["q_vectors"][q] = {} + self._configuration["q_vectors"][q]["q_vectors"] = vects[:, hits] + self._configuration["q_vectors"][q]["n_q_vectors"] = nHits + self._configuration["q_vectors"][q]["q"] = q + self._configuration["q_vectors"][q]["hkls"] = np.rint( + np.dot( + self._directUnitCell, + self._configuration["q_vectors"][q]["q_vectors"], + ) + ) + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py index df93a21ec8..0e9b68d9df 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/QVectors/SphericalLatticeQVectors.py -# @brief Implements module/class/test SphericalLatticeQVectors +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import random diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py index fa1a3ff637..d915c729dd 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py @@ -1,71 +1,75 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Framework/QVectors/SphericalQVectors.py -# @brief Implements module/class/test SphericalQVectors -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import collections - -import numpy as np - -from MDANSE.Mathematics.Geometry import random_points_on_sphere -from MDANSE.Framework.QVectors.IQVectors import IQVectors - - -class SphericalQVectors(IQVectors): - """ """ - - settings = collections.OrderedDict() - settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) - settings["shells"] = ( - "RangeConfigurator", - { - "valueType": float, - "includeLast": True, - "mini": 0.0, - "default": (0, 5.0, 0.5), - }, - ) - settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) - settings["width"] = ("FloatConfigurator", {"mini": 0.0, "default": 1.0}) - - def _generate(self): - if self._configuration["seed"]["value"] != 0: - np.random.seed(self._configuration["seed"]["value"]) - - width = self._configuration["width"]["value"] - - nVectors = self._configuration["n_vectors"]["value"] - - self._configuration["q_vectors"] = collections.OrderedDict() - - if self._status is not None: - self._status.start(len(self._configuration["shells"]["value"])) - - for q in self._configuration["shells"]["value"]: - fact = q * np.sign( - np.random.uniform(-0.5, 0.5, nVectors) - ) + width * np.random.uniform(-0.5, 0.5, nVectors) - - v = random_points_on_sphere(radius=1.0, nPoints=nVectors) - - self._configuration["q_vectors"][q] = {} - self._configuration["q_vectors"][q]["q_vectors"] = fact * v - self._configuration["q_vectors"][q]["n_q_vectors"] = nVectors - self._configuration["q_vectors"][q]["q"] = q - self._configuration["q_vectors"][q]["hkls"] = None - - if self._status is not None: - if self._status.is_stopped(): - return - else: - self._status.update() +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import collections + +import numpy as np + +from MDANSE.Mathematics.Geometry import random_points_on_sphere +from MDANSE.Framework.QVectors.IQVectors import IQVectors + + +class SphericalQVectors(IQVectors): + """ """ + + settings = collections.OrderedDict() + settings["seed"] = ("IntegerConfigurator", {"mini": 0, "default": 0}) + settings["shells"] = ( + "RangeConfigurator", + { + "valueType": float, + "includeLast": True, + "mini": 0.0, + "default": (0, 5.0, 0.5), + }, + ) + settings["n_vectors"] = ("IntegerConfigurator", {"mini": 1, "default": 50}) + settings["width"] = ("FloatConfigurator", {"mini": 0.0, "default": 1.0}) + + def _generate(self): + if self._configuration["seed"]["value"] != 0: + np.random.seed(self._configuration["seed"]["value"]) + + width = self._configuration["width"]["value"] + + nVectors = self._configuration["n_vectors"]["value"] + + self._configuration["q_vectors"] = collections.OrderedDict() + + if self._status is not None: + self._status.start(len(self._configuration["shells"]["value"])) + + for q in self._configuration["shells"]["value"]: + fact = q * np.sign( + np.random.uniform(-0.5, 0.5, nVectors) + ) + width * np.random.uniform(-0.5, 0.5, nVectors) + + v = random_points_on_sphere(radius=1.0, nPoints=nVectors) + + self._configuration["q_vectors"][q] = {} + self._configuration["q_vectors"][q]["q_vectors"] = fact * v + self._configuration["q_vectors"][q]["n_q_vectors"] = nVectors + self._configuration["q_vectors"][q]["q"] = q + self._configuration["q_vectors"][q]["hkls"] = None + + if self._status is not None: + if self._status.is_stopped(): + return + else: + self._status.update() diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py b/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py index b15e402972..b02b79ba6f 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/QVectors/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py b/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py index 9e7935818a..07690df305 100644 --- a/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py +++ b/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Session/CurrentSession.py -# @brief Beginning of the user session definition +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os from os.path import expanduser diff --git a/MDANSE/Src/MDANSE/Framework/Status.py b/MDANSE/Src/MDANSE/Framework/Status.py index ca5ee19604..d117a5abea 100644 --- a/MDANSE/Src/MDANSE/Framework/Status.py +++ b/MDANSE/Src/MDANSE/Framework/Status.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/Status.py -# @brief Implements module/class/test Status +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc diff --git a/MDANSE/Src/MDANSE/Framework/Units.py b/MDANSE/Src/MDANSE/Framework/Units.py index 82b0a22f5f..0a45f97650 100644 --- a/MDANSE/Src/MDANSE/Framework/Units.py +++ b/MDANSE/Src/MDANSE/Framework/Units.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# import copy from json.encoder import JSONEncoder import math @@ -665,7 +680,6 @@ class UnitsManager(metaclass=Singleton): PLATFORM.base_directory(), "MDANSE", "Framework", "units.json" ) - # The user path _USER_DATABASE = os.path.join(PLATFORM.application_directory(), "units.json") def __init__(self): diff --git a/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py b/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py index f83e6707ce..2f32251cef 100644 --- a/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py +++ b/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/UserDefinitionStore.py -# @brief Implements module/class/test UserDefinitionStore +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import pickle import os diff --git a/MDANSE/Src/MDANSE/Framework/__init__.py b/MDANSE/Src/MDANSE/Framework/__init__.py index ea692b8e98..7b93366a0f 100644 --- a/MDANSE/Src/MDANSE/Framework/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/__init__.py @@ -1,14 +1,18 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/IO/FortranFormat.py b/MDANSE/Src/MDANSE/IO/FortranFormat.py index 974084dee6..003e94a68b 100644 --- a/MDANSE/Src/MDANSE/IO/FortranFormat.py +++ b/MDANSE/Src/MDANSE/IO/FortranFormat.py @@ -1,23 +1,17 @@ -# This module defines a class that handles I/O using -# Fortran-compatible format specifications. +# This file is part of MDANSE. # +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# Warning: Fortran formatting is a complex business and I don't -# claim that this module works for anything complicated. It knows -# only the most frequent formatting options. Known limitations: +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# 1) Only A, D, E, F, G, I, and X formats are supported (plus string constants -# for output). -# 2) No direct support for complex numbers. You have to split them into -# real and imaginary parts before output, and for input you get -# two float numbers anyway. -# 3) No overflow check. If an output field gets too large, it will -# take more space, instead of being replaced by stars. -# -# -# Written by Konrad Hinsen -# With contributions from Andreas Prlic -# last revision: 2008-8-18 +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # """ diff --git a/MDANSE/Src/MDANSE/IO/HDF.py b/MDANSE/Src/MDANSE/IO/HDF.py index bde0b84ba1..5efc264399 100644 --- a/MDANSE/Src/MDANSE/IO/HDF.py +++ b/MDANSE/Src/MDANSE/IO/HDF.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# import numpy as np import h5py @@ -18,7 +33,6 @@ def find_numeric_variables(variables, group): else: path = "{}/{}".format(var.parent.name, var_key) - # Non numeric variables are not supported by the plotter if not np.issubdtype(var.dtype, np.number): continue diff --git a/MDANSE/Src/MDANSE/IO/HDF5.py b/MDANSE/Src/MDANSE/IO/HDF5.py index 840e5ff072..47ffa7e2ab 100644 --- a/MDANSE/Src/MDANSE/IO/HDF5.py +++ b/MDANSE/Src/MDANSE/IO/HDF5.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/IInputData.py -# @brief Implements module/class/test IInputData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import h5py import numpy as np diff --git a/MDANSE/Src/MDANSE/IO/IOUtils.py b/MDANSE/Src/MDANSE/IO/IOUtils.py index b7480bbced..4d54e64196 100644 --- a/MDANSE/Src/MDANSE/IO/IOUtils.py +++ b/MDANSE/Src/MDANSE/IO/IOUtils.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/IInputData.py -# @brief Implements module/class/test IInputData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc from collections import OrderedDict diff --git a/MDANSE/Src/MDANSE/IO/PDB.py b/MDANSE/Src/MDANSE/IO/PDB.py index 76847d059f..93ce550300 100644 --- a/MDANSE/Src/MDANSE/IO/PDB.py +++ b/MDANSE/Src/MDANSE/IO/PDB.py @@ -1,7 +1,17 @@ -# This module handles input and output of PDB files. +# This file is part of MDANSE. # -# Written by Konrad Hinsen -# Last revision: 2012-10-17 +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # """ diff --git a/MDANSE/Src/MDANSE/IO/PDBExportFilters.py b/MDANSE/Src/MDANSE/IO/PDBExportFilters.py index 291c555515..f014ac45f5 100644 --- a/MDANSE/Src/MDANSE/IO/PDBExportFilters.py +++ b/MDANSE/Src/MDANSE/IO/PDBExportFilters.py @@ -1,10 +1,20 @@ -# Export filters for PDB output. +# This file is part of MDANSE. # - - +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# A convenient base class... +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # + + class PDBExportFilter: def processLine(self, type, data): return type, data diff --git a/MDANSE/Src/MDANSE/IO/PDBReader.py b/MDANSE/Src/MDANSE/IO/PDBReader.py index 21ce3f3d0d..f73de7115c 100644 --- a/MDANSE/Src/MDANSE/IO/PDBReader.py +++ b/MDANSE/Src/MDANSE/IO/PDBReader.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# import copy import string @@ -214,7 +229,6 @@ def _process_nter_residue(self, residue): atoms_not_found = [] - # Loop over the PDB atoms of this residue for comp, pdb_atom in enumerate(pdb_atoms): # Loop over the atoms of this residue stored in the corresponding residue database entry for at, info in RESIDUES_DATABASE[code]["atoms"].items(): diff --git a/MDANSE/Src/MDANSE/IO/PDBSpaceGroups.py b/MDANSE/Src/MDANSE/IO/PDBSpaceGroups.py index e0365658f5..cb88673056 100644 --- a/MDANSE/Src/MDANSE/IO/PDBSpaceGroups.py +++ b/MDANSE/Src/MDANSE/IO/PDBSpaceGroups.py @@ -1,5 +1,17 @@ -# This module has been generated automatically from space group information -# obtained from the Computational Crystallography Toolbox +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # import numpy as np diff --git a/MDANSE/Src/MDANSE/IO/TextFile.py b/MDANSE/Src/MDANSE/IO/TextFile.py index f19049d73c..34abdcdbb9 100644 --- a/MDANSE/Src/MDANSE/IO/TextFile.py +++ b/MDANSE/Src/MDANSE/IO/TextFile.py @@ -1,7 +1,17 @@ -# Text files with automatic (un)compression and URL access. +# This file is part of MDANSE. # -# Written by: Konrad Hinsen -# Last revision: 2012-5-29 +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # """ diff --git a/MDANSE/Src/MDANSE/IO/__init__.py b/MDANSE/Src/MDANSE/IO/__init__.py index 3e03456312..7b93366a0f 100644 --- a/MDANSE/Src/MDANSE/IO/__init__.py +++ b/MDANSE/Src/MDANSE/IO/__init__.py @@ -1,14 +1,18 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Framework/InputData/HDFInputData.py -# @brief Implements module/class/test HDFInputData +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py b/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py index 1c27f38fbf..160ee20eb5 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py +++ b/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py @@ -1,69 +1,73 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Mathematics/Arithmetic.py -# @brief Implements module/class/test Arithmetic -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import math -import cmath -import itertools -from functools import reduce - -import numpy as np - - -def get_weights(props, contents, dim): - normFactor = None - - weights = {} - - cartesianProduct = set(itertools.product(list(props.keys()), repeat=dim)) - for elements in cartesianProduct: - n = np.prod([contents[el] for el in elements]) - p = np.prod(np.array([props[el] for el in elements]), axis=0) - - fact = n * p - - weights[elements] = np.float64(np.copy(fact)) - - if normFactor is None: - normFactor = fact - else: - normFactor += fact - - for k in list(weights.keys()): - weights[k] /= np.float64(normFactor) - - return weights, normFactor - - -def weight(props, values, contents, dim, key, symmetric=True): - weights = get_weights(props, contents, dim)[0] - weightedSum = None - matches = dict([(key % k, k) for k in list(weights.keys())]) - - for k, val in values.items(): - if k not in matches: - continue - - if symmetric: - permutations = set(itertools.permutations(matches[k], r=dim)) - w = sum([weights.pop(p) for p in permutations]) - else: - w = weights.pop(matches[k]) - - if weightedSum is None: - weightedSum = w * val - else: - weightedSum += w * val - - return weightedSum +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import math +import cmath +import itertools +from functools import reduce + +import numpy as np + + +def get_weights(props, contents, dim): + normFactor = None + + weights = {} + + cartesianProduct = set(itertools.product(list(props.keys()), repeat=dim)) + for elements in cartesianProduct: + n = np.prod([contents[el] for el in elements]) + p = np.prod(np.array([props[el] for el in elements]), axis=0) + + fact = n * p + + weights[elements] = np.float64(np.copy(fact)) + + if normFactor is None: + normFactor = fact + else: + normFactor += fact + + for k in list(weights.keys()): + weights[k] /= np.float64(normFactor) + + return weights, normFactor + + +def weight(props, values, contents, dim, key, symmetric=True): + weights = get_weights(props, contents, dim)[0] + weightedSum = None + matches = dict([(key % k, k) for k in list(weights.keys())]) + + for k, val in values.items(): + if k not in matches: + continue + + if symmetric: + permutations = set(itertools.permutations(matches[k], r=dim)) + w = sum([weights.pop(p) for p in permutations]) + else: + w = weights.pop(matches[k]) + + if weightedSum is None: + weightedSum = w * val + else: + weightedSum += w * val + + return weightedSum diff --git a/MDANSE/Src/MDANSE/Mathematics/Geometry.py b/MDANSE/Src/MDANSE/Mathematics/Geometry.py index 671091cfd8..7ba4e31f0b 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Geometry.py +++ b/MDANSE/Src/MDANSE/Mathematics/Geometry.py @@ -1,261 +1,265 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Mathematics/Geometry.py -# @brief Implements module/class/test Geometry -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import numpy as np -from numpy.linalg import det - -from MDANSE.Core.Error import Error -from MDANSE.Mathematics.LinearAlgebra import Vector - - -class GeometryError(Error): - pass - - -def get_basis_vectors_from_cell_parameters(parameters): - """Returns the basis vectors for the simulation cell from the six crystallographic parameters. - - :param parameters: the a, b, c, alpha, bete and gamma of the simulation cell. - :type: parameters: list of 6 floats - - :return: a list of three Scientific.Geometry.Vector objects representing respectively a, b and c basis vectors. - :rtype: list - """ - - # The simulation cell parameters. - a, b, c, alpha, beta, gamma = parameters - - # By construction the a vector is aligned with the x axis. - e1 = Vector(a, 0.0, 0.0) - - # By construction the b vector is in the xy plane. - e2 = b * Vector(np.cos(gamma), np.sin(gamma), 0.0) - - e3_x = np.cos(beta) - e3_y = (np.cos(alpha) - np.cos(beta) * np.cos(gamma)) / np.sin(gamma) - e3_z = np.sqrt(1.0 - e3_x**2 - e3_y**2) - e3 = c * Vector(e3_x, e3_y, e3_z) - - return (e1, e2, e3) - - -def center_of_mass(coords, masses=None): - """Computes the center of massfor a set of coordinates and masses - :param coords: the n input coordinates. - :type coords: (n,3)-np.array - :param masses: it not None, the n input masses. If None, the center of gravity is computed. - :type masses: (n,)-np.array - :return: the center of mass. - :rtype: (3,)-np.array - """ - - return np.average(coords, weights=masses, axis=0) - - -center = center_of_mass - - -def build_cartesian_axes(origin, p1, p2, dtype=np.float64): - origin = np.array(origin, dtype=dtype) - p1 = np.array(p1, dtype=dtype) - p2 = np.array(p2, dtype=dtype) - - v1 = p1 - origin - v2 = p2 - origin - - n1 = v1 + v2 - n1 /= np.linalg.norm(n1) - - n3 = np.cross(v1, n1) - n3 /= np.linalg.norm(n3) - - n2 = np.cross(n3, n1) - n2 /= np.linalg.norm(n2) - - return n1, n2, n3 - - -def generate_sphere_points(n): - """Returns list of 3d coordinates of points on a sphere using the - Golden Section Spiral algorithm. - """ - - points = [] - - inc = np.pi * (3 - np.sqrt(5)) - - offset = 2 / float(n) - - for k in range(int(n)): - y = k * offset - 1 + (offset / 2) - r = np.sqrt(1 - y * y) - phi = k * inc - points.append([np.cos(phi) * r, y, np.sin(phi) * r]) - - return points - - -def random_points_on_sphere(radius=1.0, nPoints=100): - points = np.zeros((3, nPoints), dtype=np.float64) - - theta = 2.0 * np.pi * np.random.uniform(nPoints) - u = np.random.uniform(-1.0, 1.0, nPoints) - points[0, :] = radius * np.sqrt(1 - u**2) * np.cos(theta) - points[1, :] = radius * np.sqrt(1 - u**2) * np.sin(theta) - points[2, :] = radius * u - - return points - - -def random_points_on_disk(axis, radius=1.0, nPoints=100): - axis = Vector(axis).normal().array - - points = np.random.uniform(-radius, radius, 3 * nPoints) - points = points.reshape((3, nPoints)) - - proj = np.dot(axis, points) - proj = np.dot(axis[:, np.newaxis], proj[np.newaxis, :]) - - points -= proj - - return points - - -def random_points_on_circle(axis, radius=1.0, nPoints=100): - axis = Vector(axis).normal().array - - points = np.random.uniform(-radius, radius, 3 * nPoints) - points = points.reshape((3, nPoints)) - - proj = np.dot(axis, points) - proj = np.dot(axis[:, np.newaxis], proj[np.newaxis, :]) - - points -= proj - - points *= radius / np.sqrt(np.sum(points**2, axis=0)) - - return points - - -def almost(a, b, tolerance=1e-7): - return abs(a - b) < tolerance - - -def get_euler_angles(rotation, tolerance=1e-5): - """ - R must be an indexable of shape (3,3) and represent and ORTHOGONAL POSITIVE - DEFINITE matrix. - """ - - fuzz = 1e-3 - rotation = np.asarray(rotation, float) - - if det(rotation) < 0.0: - raise GeometryError("determinant is negative\n" + str(rotation)) - - if not np.allclose(np.mat(rotation) * rotation.T, np.identity(3), atol=tolerance): - raise GeometryError("not an orthogonal matrix\n" + str(rotation)) - cang = 2.0 - np.sum( - np.square( - [ - rotation[0, 2], - rotation[1, 2], - rotation[2, 0], - rotation[2, 1], - rotation[2, 2], - ] - ) - ) - cang = np.sqrt(min(max(cang, 0.0), 1.0)) - if rotation[2, 2] < 0.0: - cang = -cang - ang = np.arccos(cang) - beta = np.degrees(ang) - sang = np.sin(ang) - if sang > fuzz: - alpha = np.degrees(np.arctan2(rotation[1, 2], rotation[0, 2])) - gamma = np.degrees(np.arctan2(rotation[2, 1], -rotation[2, 0])) - else: - alpha = np.degrees(np.arctan2(-rotation[0, 1], rotation[0, 0] * rotation[2, 2])) - gamma = 0.0 - if almost(beta, 0.0, fuzz): - alpha, beta, gamma = alpha + gamma, 0.0, 0.0 - elif almost(beta, 180.0, fuzz): - alpha, beta, gamma = alpha - gamma, 180.0, 0.0 - alpha = np.mod(alpha, 360.0) - gamma = np.mod(gamma, 360.0) - if almost(alpha, 360.0, fuzz): - alpha = 0.0 - if almost(gamma, 360.0, fuzz): - gamma = 0.0 - return alpha, beta, gamma - - -def superposition_fit(confs): - """ - :param confs: the weight, reference position, and alternate position for each atom - :type confs: sequence of (float, Vector, Vector) - :returns: the quaternion representing the rotation, - the center of mass in the reference configuration, - the center of mass in the alternate configuraton, - and the RMS distance after the optimal superposition - """ - w_sum = 0.0 - wr_sum = np.zeros((3,), np.float64) - for w, r_ref, r in confs: - w_sum += w - wr_sum += w * r_ref.array - ref_cms = wr_sum / w_sum - pos = np.zeros((3,), np.float64) - possq = 0.0 - cross = np.zeros((3, 3), np.float64) - for w, r_ref, r in confs: - w = w / w_sum - r_ref = r_ref.array - ref_cms - r = r.array - pos = pos + w * r - possq = possq + w * np.add.reduce(r * r) + w * np.add.reduce(r_ref * r_ref) - cross = cross + w * r[:, np.newaxis] * r_ref[np.newaxis, :] - k = np.zeros((4, 4), np.float64) - k[0, 0] = -cross[0, 0] - cross[1, 1] - cross[2, 2] - k[0, 1] = cross[1, 2] - cross[2, 1] - k[0, 2] = cross[2, 0] - cross[0, 2] - k[0, 3] = cross[0, 1] - cross[1, 0] - k[1, 1] = -cross[0, 0] + cross[1, 1] + cross[2, 2] - k[1, 2] = -cross[0, 1] - cross[1, 0] - k[1, 3] = -cross[0, 2] - cross[2, 0] - k[2, 2] = cross[0, 0] - cross[1, 1] + cross[2, 2] - k[2, 3] = -cross[1, 2] - cross[2, 1] - k[3, 3] = cross[0, 0] + cross[1, 1] - cross[2, 2] - for i in range(1, 4): - for j in range(i): - k[i, j] = k[j, i] - k = 2.0 * k - for i in range(4): - k[i, i] = k[i, i] + possq - np.add.reduce(pos * pos) - e, v = np.linalg.eig(k) - v = np.transpose(v) - i = np.argmin(e) - v = v[i] - if v[0] < 0: - v = -v - if e[i] <= 0.0: - rms = 0.0 - else: - rms = np.sqrt(e[i]) - - from MDANSE.Mathematics.LinearAlgebra import Quaternion, Vector - - return Quaternion(v), Vector(ref_cms), Vector(pos), rms +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import numpy as np +from numpy.linalg import det + +from MDANSE.Core.Error import Error +from MDANSE.Mathematics.LinearAlgebra import Vector + + +class GeometryError(Error): + pass + + +def get_basis_vectors_from_cell_parameters(parameters): + """Returns the basis vectors for the simulation cell from the six crystallographic parameters. + + :param parameters: the a, b, c, alpha, bete and gamma of the simulation cell. + :type: parameters: list of 6 floats + + :return: a list of three Scientific.Geometry.Vector objects representing respectively a, b and c basis vectors. + :rtype: list + """ + + # The simulation cell parameters. + a, b, c, alpha, beta, gamma = parameters + + # By construction the a vector is aligned with the x axis. + e1 = Vector(a, 0.0, 0.0) + + # By construction the b vector is in the xy plane. + e2 = b * Vector(np.cos(gamma), np.sin(gamma), 0.0) + + e3_x = np.cos(beta) + e3_y = (np.cos(alpha) - np.cos(beta) * np.cos(gamma)) / np.sin(gamma) + e3_z = np.sqrt(1.0 - e3_x**2 - e3_y**2) + e3 = c * Vector(e3_x, e3_y, e3_z) + + return (e1, e2, e3) + + +def center_of_mass(coords, masses=None): + """Computes the center of massfor a set of coordinates and masses + :param coords: the n input coordinates. + :type coords: (n,3)-np.array + :param masses: it not None, the n input masses. If None, the center of gravity is computed. + :type masses: (n,)-np.array + :return: the center of mass. + :rtype: (3,)-np.array + """ + + return np.average(coords, weights=masses, axis=0) + + +center = center_of_mass + + +def build_cartesian_axes(origin, p1, p2, dtype=np.float64): + origin = np.array(origin, dtype=dtype) + p1 = np.array(p1, dtype=dtype) + p2 = np.array(p2, dtype=dtype) + + v1 = p1 - origin + v2 = p2 - origin + + n1 = v1 + v2 + n1 /= np.linalg.norm(n1) + + n3 = np.cross(v1, n1) + n3 /= np.linalg.norm(n3) + + n2 = np.cross(n3, n1) + n2 /= np.linalg.norm(n2) + + return n1, n2, n3 + + +def generate_sphere_points(n): + """Returns list of 3d coordinates of points on a sphere using the + Golden Section Spiral algorithm. + """ + + points = [] + + inc = np.pi * (3 - np.sqrt(5)) + + offset = 2 / float(n) + + for k in range(int(n)): + y = k * offset - 1 + (offset / 2) + r = np.sqrt(1 - y * y) + phi = k * inc + points.append([np.cos(phi) * r, y, np.sin(phi) * r]) + + return points + + +def random_points_on_sphere(radius=1.0, nPoints=100): + points = np.zeros((3, nPoints), dtype=np.float64) + + theta = 2.0 * np.pi * np.random.uniform(nPoints) + u = np.random.uniform(-1.0, 1.0, nPoints) + points[0, :] = radius * np.sqrt(1 - u**2) * np.cos(theta) + points[1, :] = radius * np.sqrt(1 - u**2) * np.sin(theta) + points[2, :] = radius * u + + return points + + +def random_points_on_disk(axis, radius=1.0, nPoints=100): + axis = Vector(axis).normal().array + + points = np.random.uniform(-radius, radius, 3 * nPoints) + points = points.reshape((3, nPoints)) + + proj = np.dot(axis, points) + proj = np.dot(axis[:, np.newaxis], proj[np.newaxis, :]) + + points -= proj + + return points + + +def random_points_on_circle(axis, radius=1.0, nPoints=100): + axis = Vector(axis).normal().array + + points = np.random.uniform(-radius, radius, 3 * nPoints) + points = points.reshape((3, nPoints)) + + proj = np.dot(axis, points) + proj = np.dot(axis[:, np.newaxis], proj[np.newaxis, :]) + + points -= proj + + points *= radius / np.sqrt(np.sum(points**2, axis=0)) + + return points + + +def almost(a, b, tolerance=1e-7): + return abs(a - b) < tolerance + + +def get_euler_angles(rotation, tolerance=1e-5): + """ + R must be an indexable of shape (3,3) and represent and ORTHOGONAL POSITIVE + DEFINITE matrix. + """ + + fuzz = 1e-3 + rotation = np.asarray(rotation, float) + + if det(rotation) < 0.0: + raise GeometryError("determinant is negative\n" + str(rotation)) + + if not np.allclose(np.mat(rotation) * rotation.T, np.identity(3), atol=tolerance): + raise GeometryError("not an orthogonal matrix\n" + str(rotation)) + cang = 2.0 - np.sum( + np.square( + [ + rotation[0, 2], + rotation[1, 2], + rotation[2, 0], + rotation[2, 1], + rotation[2, 2], + ] + ) + ) + cang = np.sqrt(min(max(cang, 0.0), 1.0)) + if rotation[2, 2] < 0.0: + cang = -cang + ang = np.arccos(cang) + beta = np.degrees(ang) + sang = np.sin(ang) + if sang > fuzz: + alpha = np.degrees(np.arctan2(rotation[1, 2], rotation[0, 2])) + gamma = np.degrees(np.arctan2(rotation[2, 1], -rotation[2, 0])) + else: + alpha = np.degrees(np.arctan2(-rotation[0, 1], rotation[0, 0] * rotation[2, 2])) + gamma = 0.0 + if almost(beta, 0.0, fuzz): + alpha, beta, gamma = alpha + gamma, 0.0, 0.0 + elif almost(beta, 180.0, fuzz): + alpha, beta, gamma = alpha - gamma, 180.0, 0.0 + alpha = np.mod(alpha, 360.0) + gamma = np.mod(gamma, 360.0) + if almost(alpha, 360.0, fuzz): + alpha = 0.0 + if almost(gamma, 360.0, fuzz): + gamma = 0.0 + return alpha, beta, gamma + + +def superposition_fit(confs): + """ + :param confs: the weight, reference position, and alternate position for each atom + :type confs: sequence of (float, Vector, Vector) + :returns: the quaternion representing the rotation, + the center of mass in the reference configuration, + the center of mass in the alternate configuraton, + and the RMS distance after the optimal superposition + """ + w_sum = 0.0 + wr_sum = np.zeros((3,), np.float64) + for w, r_ref, r in confs: + w_sum += w + wr_sum += w * r_ref.array + ref_cms = wr_sum / w_sum + pos = np.zeros((3,), np.float64) + possq = 0.0 + cross = np.zeros((3, 3), np.float64) + for w, r_ref, r in confs: + w = w / w_sum + r_ref = r_ref.array - ref_cms + r = r.array + pos = pos + w * r + possq = possq + w * np.add.reduce(r * r) + w * np.add.reduce(r_ref * r_ref) + cross = cross + w * r[:, np.newaxis] * r_ref[np.newaxis, :] + k = np.zeros((4, 4), np.float64) + k[0, 0] = -cross[0, 0] - cross[1, 1] - cross[2, 2] + k[0, 1] = cross[1, 2] - cross[2, 1] + k[0, 2] = cross[2, 0] - cross[0, 2] + k[0, 3] = cross[0, 1] - cross[1, 0] + k[1, 1] = -cross[0, 0] + cross[1, 1] + cross[2, 2] + k[1, 2] = -cross[0, 1] - cross[1, 0] + k[1, 3] = -cross[0, 2] - cross[2, 0] + k[2, 2] = cross[0, 0] - cross[1, 1] + cross[2, 2] + k[2, 3] = -cross[1, 2] - cross[2, 1] + k[3, 3] = cross[0, 0] + cross[1, 1] - cross[2, 2] + for i in range(1, 4): + for j in range(i): + k[i, j] = k[j, i] + k = 2.0 * k + for i in range(4): + k[i, i] = k[i, i] + possq - np.add.reduce(pos * pos) + e, v = np.linalg.eig(k) + v = np.transpose(v) + i = np.argmin(e) + v = v[i] + if v[0] < 0: + v = -v + if e[i] <= 0.0: + rms = 0.0 + else: + rms = np.sqrt(e[i]) + + from MDANSE.Mathematics.LinearAlgebra import Quaternion, Vector + + return Quaternion(v), Vector(ref_cms), Vector(pos), rms diff --git a/MDANSE/Src/MDANSE/Mathematics/Graph.py b/MDANSE/Src/MDANSE/Mathematics/Graph.py index 71cd582700..947b4af317 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Graph.py +++ b/MDANSE/Src/MDANSE/Mathematics/Graph.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Mathematics/Graph.py -# @brief Implements module/class/test Graph +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Mathematics/LinearAlgebra.py b/MDANSE/Src/MDANSE/Mathematics/LinearAlgebra.py index 7741fc4b96..8a3330e60f 100644 --- a/MDANSE/Src/MDANSE/Mathematics/LinearAlgebra.py +++ b/MDANSE/Src/MDANSE/Mathematics/LinearAlgebra.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# import numpy as np @@ -600,9 +615,6 @@ def inverse(self): raise ValueError("Undefined operation") -# Type check - - def is_tensor(x): """ @returns: C{True} if x is a L{Tensor} diff --git a/MDANSE/Src/MDANSE/Mathematics/Signal.py b/MDANSE/Src/MDANSE/Mathematics/Signal.py index dc86b7502a..e60ecf49e6 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Signal.py +++ b/MDANSE/Src/MDANSE/Mathematics/Signal.py @@ -1,286 +1,290 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/Mathematics/Signal.py -# @brief Implements module/class/test Signal -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import numpy as np - -from MDANSE.Core.Error import Error - - -class SignalError(Error): - pass - - -INTERPOLATION_ORDER = {} - -INTERPOLATION_ORDER[1] = np.array( - [[-3.0, 4.0, -1.0], [-1.0, 0.0, 1.0], [1.0, -4.0, 3.0]], dtype=np.float64 -) - - -INTERPOLATION_ORDER[2] = np.array( - [[-3.0, 4.0, -1.0], [-1.0, 0.0, 1.0], [1.0, -4.0, 3.0]], dtype=np.float64 -) - -INTERPOLATION_ORDER[3] = np.array( - [ - [-11.0, 18.0, -9.0, 2.0], - [-2.0, -3.0, 6.0, -1.0], - [1.0, -6.0, 3.0, 2.0], - [-2.0, 9.0, -18.0, 11.0], - ], - dtype=np.float64, -) - -INTERPOLATION_ORDER[4] = np.array( - [ - [-50.0, 96.0, -72.0, 32.0, -6.0], - [-6.0, -20.0, 36.0, -12.0, 2.0], - [2.0, -16.0, 0.0, 16.0, -2.0], - [-2.0, 12.0, -36.0, 20.0, 6.0], - [6.0, -32.0, 72.0, -96.0, 50.0], - ], - dtype=np.float64, -) - -INTERPOLATION_ORDER[5] = np.array( - [ - [-274.0, 600.0, -600.0, 400.0, -150.0, 24.0], - [-24.0, -130.0, 240.0, -120.0, 40.0, -6.0], - [6.0, -60.0, -40.0, 120.0, -30.0, 4.0], - [-4.0, 30.0, -120.0, 40.0, 60.0, -6.0], - [6.0, -40.0, 120.0, -240.0, 130.0, 24.0], - [-24.0, 150.0, -400.0, 600.0, -600.0, 274.0], - ], - dtype=np.float64, -) - - -def correlation(x, y=None, axis=0, sumOverAxis=None, average=None): - """Returns the numerical correlation between two signals. - - :param x: the first signal. - :type x: NumPy array - - :param y: if not None, the correlation is performed between `x` and `y`. If None, the autocorrelation of `x` will be computed. - :type y: NumPy array or None - - :param axis: the axis along which the correlation will be computed. - :type axis: int - - :param sumOverAxis: if not None, the computed correlations will be sum over a given axis. - :type sumOverAxis: int or None - - :param average: if not None, the computed correlations will be averaged over a given axis. - :type average: int or None - - :return: the result of the numerical correlation. - :rtype: NumPy array - - :note: The correlation is computed using the FCA algorithm. - """ - - x = np.array(x) - - n = x.shape[axis] - - X = np.fft.fft(x, 2 * n, axis=axis) - - if y is not None: - y = np.array(y) - Y = np.fft.fft(y, 2 * n, axis=axis) - else: - Y = X - - s = [slice(None)] * x.ndim - - s[axis] = slice(0, n, 1) # the total lenght along 'axis' direction is 2*n - # s selects all elements along all other directions, - # and only half the elements along the 'axis' direction. - - s = tuple(s) - - corr = np.real(np.fft.ifft(np.conjugate(X) * Y, axis=axis)[s]) - - norm = n - np.arange(n) - - s = [np.newaxis] * x.ndim - s[axis] = slice(None) - - s = tuple(s) - - corr = corr / norm[s] - - if sumOverAxis is not None: - corr = np.sum(corr, axis=sumOverAxis) - elif average is not None: - corr = np.average(corr, axis=average) - - return corr - - -def normalize(x, axis=0): - s = [slice(None)] * x.ndim - s[axis] = slice(0, 1, 1) - - s = tuple(s) - - nx = x / x[s] - return nx - - -def differentiate(a, dt=1.0, order=1): - if order not in INTERPOLATION_ORDER: - raise SignalError("Invalid differentiation order") - - coefs = INTERPOLATION_ORDER[order] - - # outputSeries is the output resulting from the differentiation - ts = np.zeros(a.shape, dtype=np.float64) - - fact = 1.0 / dt - - if order == 1: - ts[0] = np.add.reduce(coefs[0, :] * a[:3]) - ts[-1] = np.add.reduce(coefs[2, :] * a[-3:]) - - gj = a[1:] - a[:-1] - ts[1:-1] = gj[1:] + gj[:-1] - - fact /= 2.0 - - # Case of the order 2 - elif order == 2: - ts[0] = np.add.reduce(coefs[0, :] * a[:3]) - ts[-1] = np.add.reduce(coefs[2, :] * a[-3:]) - - gj = np.zeros((a.size - 2, 3), dtype=np.float64) - gj[:, 0] = coefs[1, 0] * a[:-2] - gj[:, 1] = coefs[1, 1] * a[1:-1] - gj[:, 2] = coefs[1, 2] * a[2:] - ts[1:-1] = np.add.reduce(gj, -1) - - fact /= 2.0 - - # Case of the order 3 - elif order == 3: - # Special case for the first and last elements - ts[0] = np.add.reduce(coefs[0, :] * a[:4]) - ts[1] = np.add.reduce(coefs[1, :] * a[:4]) - ts[-1] = np.add.reduce(coefs[3, :] * a[-4:]) - - # General case - gj = np.zeros((a.size - 3, 4), dtype=np.float64) - gj[:, 0] = coefs[2, 0] * a[:-3] - gj[:, 1] = coefs[2, 1] * a[1:-2] - gj[:, 2] = coefs[2, 2] * a[2:-1] - gj[:, 3] = coefs[2, 3] * a[3:] - ts[2:-1] = np.add.reduce(gj, -1) - - fact /= 6.0 - - # Case of the order 4 - elif order == 4: - # Special case for the first and last elements - ts[0] = np.add.reduce(coefs[0, :] * a[:5]) - ts[1] = np.add.reduce(coefs[1, :] * a[:5]) - ts[-2] = np.add.reduce(coefs[3, :] * a[-5:]) - ts[-1] = np.add.reduce(coefs[4, :] * a[-5:]) - - # General case - gj = np.zeros((a.size - 4, 5), dtype=np.float64) - gj[:, 0] = coefs[2, 0] * a[:-4] - gj[:, 1] = coefs[2, 1] * a[1:-3] - gj[:, 2] = coefs[2, 2] * a[2:-2] - gj[:, 3] = coefs[2, 3] * a[3:-1] - gj[:, 4] = coefs[2, 4] * a[4:] - ts[2:-2] = np.add.reduce(gj, -1) - - fact /= 24.0 - - # Case of the order 5 - elif order == 5: - # Special case for the first and last elements - ts[0] = np.add.reduce(coefs[0, :] * a[:6]) - ts[1] = np.add.reduce(coefs[1, :] * a[:6]) - ts[2] = np.add.reduce(coefs[2, :] * a[:6]) - ts[-2] = np.add.reduce(coefs[4, :] * a[-6:]) - ts[-1] = np.add.reduce(coefs[5, :] * a[-6:]) - - # General case - gj = np.zeros((a.size - 5, 6), dtype=np.float64) - gj[:, 0] = coefs[3, 0] * a[:-5] - gj[:, 1] = coefs[3, 1] * a[1:-4] - gj[:, 2] = coefs[3, 2] * a[2:-3] - gj[:, 3] = coefs[3, 3] * a[3:-2] - gj[:, 4] = coefs[3, 4] * a[4:-1] - gj[:, 5] = coefs[3, 5] * a[5:] - ts[3:-2] = np.add.reduce(gj, -1) - - fact /= 120.0 - - ts *= fact - - return ts - - -def symmetrize(signal, axis=0): - """Return a symmetrized version of an input signal - - :Parameters: - #. signal (np.array): the input signal - #. axis (int): the axis along which the signal should be symmetrized - :Returns: - #. np.array: the symmetrized signal - """ - - s = [slice(None)] * signal.ndim - s[axis] = slice(-1, 0, -1) - - s = tuple(s) - - signal = np.concatenate((signal[s], signal), axis=axis) - - return signal - - -def get_spectrum(signal, window=None, timeStep=1.0, axis=0): - signal = symmetrize(signal, axis) - - if window is None: - window = np.ones(signal.shape[axis]) - - window /= window[len(window) // 2] - - s = [np.newaxis] * signal.ndim - s[axis] = slice(None) - - s = tuple(s) - - # We compute the unitary inverse fourier transform with angular frequencies as described in - # https://en.wikipedia.org/wiki/Fourier_transform#Discrete_Fourier_Transforms_and_Fast_Fourier_Transforms - - # For information about the manipulation around fftshift and ifftshift - # http://www.mathworks.com/matlabcentral/newsreader/view_thread/285244 - - fftSignal = ( - 0.5 - * np.fft.fftshift( - np.fft.fft(np.fft.ifftshift(signal * window[s], axes=axis), axis=axis), - axes=axis, - ) - * timeStep - / np.pi - ) - return fftSignal.real +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import numpy as np + +from MDANSE.Core.Error import Error + + +class SignalError(Error): + pass + + +INTERPOLATION_ORDER = {} + +INTERPOLATION_ORDER[1] = np.array( + [[-3.0, 4.0, -1.0], [-1.0, 0.0, 1.0], [1.0, -4.0, 3.0]], dtype=np.float64 +) + + +INTERPOLATION_ORDER[2] = np.array( + [[-3.0, 4.0, -1.0], [-1.0, 0.0, 1.0], [1.0, -4.0, 3.0]], dtype=np.float64 +) + +INTERPOLATION_ORDER[3] = np.array( + [ + [-11.0, 18.0, -9.0, 2.0], + [-2.0, -3.0, 6.0, -1.0], + [1.0, -6.0, 3.0, 2.0], + [-2.0, 9.0, -18.0, 11.0], + ], + dtype=np.float64, +) + +INTERPOLATION_ORDER[4] = np.array( + [ + [-50.0, 96.0, -72.0, 32.0, -6.0], + [-6.0, -20.0, 36.0, -12.0, 2.0], + [2.0, -16.0, 0.0, 16.0, -2.0], + [-2.0, 12.0, -36.0, 20.0, 6.0], + [6.0, -32.0, 72.0, -96.0, 50.0], + ], + dtype=np.float64, +) + +INTERPOLATION_ORDER[5] = np.array( + [ + [-274.0, 600.0, -600.0, 400.0, -150.0, 24.0], + [-24.0, -130.0, 240.0, -120.0, 40.0, -6.0], + [6.0, -60.0, -40.0, 120.0, -30.0, 4.0], + [-4.0, 30.0, -120.0, 40.0, 60.0, -6.0], + [6.0, -40.0, 120.0, -240.0, 130.0, 24.0], + [-24.0, 150.0, -400.0, 600.0, -600.0, 274.0], + ], + dtype=np.float64, +) + + +def correlation(x, y=None, axis=0, sumOverAxis=None, average=None): + """Returns the numerical correlation between two signals. + + :param x: the first signal. + :type x: NumPy array + + :param y: if not None, the correlation is performed between `x` and `y`. If None, the autocorrelation of `x` will be computed. + :type y: NumPy array or None + + :param axis: the axis along which the correlation will be computed. + :type axis: int + + :param sumOverAxis: if not None, the computed correlations will be sum over a given axis. + :type sumOverAxis: int or None + + :param average: if not None, the computed correlations will be averaged over a given axis. + :type average: int or None + + :return: the result of the numerical correlation. + :rtype: NumPy array + + :note: The correlation is computed using the FCA algorithm. + """ + + x = np.array(x) + + n = x.shape[axis] + + X = np.fft.fft(x, 2 * n, axis=axis) + + if y is not None: + y = np.array(y) + Y = np.fft.fft(y, 2 * n, axis=axis) + else: + Y = X + + s = [slice(None)] * x.ndim + + s[axis] = slice(0, n, 1) # the total lenght along 'axis' direction is 2*n + # s selects all elements along all other directions, + # and only half the elements along the 'axis' direction. + + s = tuple(s) + + corr = np.real(np.fft.ifft(np.conjugate(X) * Y, axis=axis)[s]) + + norm = n - np.arange(n) + + s = [np.newaxis] * x.ndim + s[axis] = slice(None) + + s = tuple(s) + + corr = corr / norm[s] + + if sumOverAxis is not None: + corr = np.sum(corr, axis=sumOverAxis) + elif average is not None: + corr = np.average(corr, axis=average) + + return corr + + +def normalize(x, axis=0): + s = [slice(None)] * x.ndim + s[axis] = slice(0, 1, 1) + + s = tuple(s) + + nx = x / x[s] + return nx + + +def differentiate(a, dt=1.0, order=1): + if order not in INTERPOLATION_ORDER: + raise SignalError("Invalid differentiation order") + + coefs = INTERPOLATION_ORDER[order] + + # outputSeries is the output resulting from the differentiation + ts = np.zeros(a.shape, dtype=np.float64) + + fact = 1.0 / dt + + if order == 1: + ts[0] = np.add.reduce(coefs[0, :] * a[:3]) + ts[-1] = np.add.reduce(coefs[2, :] * a[-3:]) + + gj = a[1:] - a[:-1] + ts[1:-1] = gj[1:] + gj[:-1] + + fact /= 2.0 + + # Case of the order 2 + elif order == 2: + ts[0] = np.add.reduce(coefs[0, :] * a[:3]) + ts[-1] = np.add.reduce(coefs[2, :] * a[-3:]) + + gj = np.zeros((a.size - 2, 3), dtype=np.float64) + gj[:, 0] = coefs[1, 0] * a[:-2] + gj[:, 1] = coefs[1, 1] * a[1:-1] + gj[:, 2] = coefs[1, 2] * a[2:] + ts[1:-1] = np.add.reduce(gj, -1) + + fact /= 2.0 + + # Case of the order 3 + elif order == 3: + # Special case for the first and last elements + ts[0] = np.add.reduce(coefs[0, :] * a[:4]) + ts[1] = np.add.reduce(coefs[1, :] * a[:4]) + ts[-1] = np.add.reduce(coefs[3, :] * a[-4:]) + + # General case + gj = np.zeros((a.size - 3, 4), dtype=np.float64) + gj[:, 0] = coefs[2, 0] * a[:-3] + gj[:, 1] = coefs[2, 1] * a[1:-2] + gj[:, 2] = coefs[2, 2] * a[2:-1] + gj[:, 3] = coefs[2, 3] * a[3:] + ts[2:-1] = np.add.reduce(gj, -1) + + fact /= 6.0 + + # Case of the order 4 + elif order == 4: + # Special case for the first and last elements + ts[0] = np.add.reduce(coefs[0, :] * a[:5]) + ts[1] = np.add.reduce(coefs[1, :] * a[:5]) + ts[-2] = np.add.reduce(coefs[3, :] * a[-5:]) + ts[-1] = np.add.reduce(coefs[4, :] * a[-5:]) + + # General case + gj = np.zeros((a.size - 4, 5), dtype=np.float64) + gj[:, 0] = coefs[2, 0] * a[:-4] + gj[:, 1] = coefs[2, 1] * a[1:-3] + gj[:, 2] = coefs[2, 2] * a[2:-2] + gj[:, 3] = coefs[2, 3] * a[3:-1] + gj[:, 4] = coefs[2, 4] * a[4:] + ts[2:-2] = np.add.reduce(gj, -1) + + fact /= 24.0 + + # Case of the order 5 + elif order == 5: + # Special case for the first and last elements + ts[0] = np.add.reduce(coefs[0, :] * a[:6]) + ts[1] = np.add.reduce(coefs[1, :] * a[:6]) + ts[2] = np.add.reduce(coefs[2, :] * a[:6]) + ts[-2] = np.add.reduce(coefs[4, :] * a[-6:]) + ts[-1] = np.add.reduce(coefs[5, :] * a[-6:]) + + # General case + gj = np.zeros((a.size - 5, 6), dtype=np.float64) + gj[:, 0] = coefs[3, 0] * a[:-5] + gj[:, 1] = coefs[3, 1] * a[1:-4] + gj[:, 2] = coefs[3, 2] * a[2:-3] + gj[:, 3] = coefs[3, 3] * a[3:-2] + gj[:, 4] = coefs[3, 4] * a[4:-1] + gj[:, 5] = coefs[3, 5] * a[5:] + ts[3:-2] = np.add.reduce(gj, -1) + + fact /= 120.0 + + ts *= fact + + return ts + + +def symmetrize(signal, axis=0): + """Return a symmetrized version of an input signal + + :Parameters: + #. signal (np.array): the input signal + #. axis (int): the axis along which the signal should be symmetrized + :Returns: + #. np.array: the symmetrized signal + """ + + s = [slice(None)] * signal.ndim + s[axis] = slice(-1, 0, -1) + + s = tuple(s) + + signal = np.concatenate((signal[s], signal), axis=axis) + + return signal + + +def get_spectrum(signal, window=None, timeStep=1.0, axis=0): + signal = symmetrize(signal, axis) + + if window is None: + window = np.ones(signal.shape[axis]) + + window /= window[len(window) // 2] + + s = [np.newaxis] * signal.ndim + s[axis] = slice(None) + + s = tuple(s) + + # We compute the unitary inverse fourier transform with angular frequencies as described in + # https://en.wikipedia.org/wiki/Fourier_transform#Discrete_Fourier_Transforms_and_Fast_Fourier_Transforms + + # For information about the manipulation around fftshift and ifftshift + # http://www.mathworks.com/matlabcentral/newsreader/view_thread/285244 + + fftSignal = ( + 0.5 + * np.fft.fftshift( + np.fft.fft(np.fft.ifftshift(signal * window[s], axes=axis), axis=axis), + axes=axis, + ) + * timeStep + / np.pi + ) + return fftSignal.real diff --git a/MDANSE/Src/MDANSE/Mathematics/Transformation.py b/MDANSE/Src/MDANSE/Mathematics/Transformation.py index 8ed6c5d8c7..7a4a7f5213 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Transformation.py +++ b/MDANSE/Src/MDANSE/Mathematics/Transformation.py @@ -1,9 +1,17 @@ -# This module defines classes that represent coordinate translations, -# rotations, and combinations of translation and rotation. +# This file is part of MDANSE. # -# Written by: Konrad Hinsen -# Contributions from Pierre Legrand -# last revision: 2011-1-24 +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # """ diff --git a/MDANSE/Src/MDANSE/Mathematics/__init__.py b/MDANSE/Src/MDANSE/Mathematics/__init__.py index 157b9f8995..7b93366a0f 100644 --- a/MDANSE/Src/MDANSE/Mathematics/__init__.py +++ b/MDANSE/Src/MDANSE/Mathematics/__init__.py @@ -1,14 +1,18 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/Mathematics/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py b/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py index 9559a97ca8..d6064ad578 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/MolecularDynamics/Analysis.py -# @brief Implements module/class/test Analysis +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np from numpy.typing import NDArray diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Configuration.py b/MDANSE/Src/MDANSE/MolecularDynamics/Configuration.py index 7a6a6ab11e..0ee557d6c3 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Configuration.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Configuration.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from __future__ import annotations import abc import copy @@ -111,8 +126,6 @@ def apply_transformation(self, transfo: RigidBodyTransformation) -> None: rot = transfo.rotation().tensor.array conf[:] = np.dot(conf, np.transpose(rot)) - # The casting here must be set to 'unsafe' to allow for conversion from int to float; the vector array may be - # of float dtype while conf, after the dot product, can be int. np.add( conf, transfo.translation().vector.array[np.newaxis, :], diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Connectivity.py b/MDANSE/Src/MDANSE/MolecularDynamics/Connectivity.py index 692d7ab2b6..2469c0cd95 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Connectivity.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Connectivity.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/MolecularDynamics/Connectivity.py -# @brief A simple molecule detection tool. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Maciej Bartkowiak +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Maciej Bartkowiak from itertools import product from typing import List, Dict diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py b/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py index edb966acf2..744db08474 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/MolecularDynamics/Trajectory.py -# @brief Implements module/class/test Trajectory +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import math import json diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py b/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py index e660f2f351..f18a09073d 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/MolecularDynamics/Trajectory.py -# @brief Implements module/class/test Trajectory +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from ast import operator import os diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py b/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py index 4e80587586..2c7a1a7a6c 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/MolecularDynamics/Trajectory.py -# @brief Implements module/class/test Trajectory +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import operator from typing import Union, Iterable diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/UnitCell.py b/MDANSE/Src/MDANSE/MolecularDynamics/UnitCell.py index f1ff2886bf..7ed437f44a 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/UnitCell.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/UnitCell.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# import numpy as np from numpy.typing import ArrayLike diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py b/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py index 65cbd9ac8b..7b93366a0f 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py @@ -1,14 +1,18 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/MolecularDynamics/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/Coverage.py b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/Coverage.py index 6c2b4d445c..890a713c63 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/Coverage.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/Coverage.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Coverage/Coverage.py -# @brief Base class for neutron instrument coverage +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/TotalCoverage.py b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/TotalCoverage.py index 18142bc9dd..8f2b1849a5 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/TotalCoverage.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/TotalCoverage.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Coverage/TotalCoverage.py -# @brief A Null coverage: every angle covered +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.Coverage.Coverage import Coverage diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/__init__.py index 43489bfeb8..f3a898a852 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Coverage/__init__.py -# @brief Implements __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) """Instrument coverage will be expressed as angular coverage of detectors. By specifying the angle coverage of detector panels, diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/IdealInstrument.py b/MDANSE/Src/MDANSE/NeutronInstruments/IdealInstrument.py index 1583fd410d..17ef7be27c 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/IdealInstrument.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/IdealInstrument.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/__init__.py -# @brief Implements __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.NeutronInstrument import NeutronInstrument from MDANSE.NeutronInstruments.Coverage.Coverage import Coverage diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Method/NullMethod.py b/MDANSE/Src/MDANSE/NeutronInstruments/Method/NullMethod.py index 8154230b95..9a99bb12ea 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Method/NullMethod.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Method/NullMethod.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Method/NullMethod.py -# @brief Elastic scattering, time of flight method +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.Method.ScatteringMethod import ScatteringMethod diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Method/ScatteringMethod.py b/MDANSE/Src/MDANSE/NeutronInstruments/Method/ScatteringMethod.py index 5a6197bf49..d7276b85dd 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Method/ScatteringMethod.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Method/ScatteringMethod.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Method/ScatteringMethod.py -# @brief Base class for neutron instrument resolution +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Method/TOFDiffraction.py b/MDANSE/Src/MDANSE/NeutronInstruments/Method/TOFDiffraction.py index de004866d7..a901106d70 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Method/TOFDiffraction.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Method/TOFDiffraction.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Method/TOFDiffraction.py -# @brief Elastic scattering, time of flight method +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.Method.ScatteringMethod import ScatteringMethod diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Method/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/Method/__init__.py index 540c5c2c6a..c4872fee4f 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Method/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Method/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Method/__init__.py -# @brief Implements __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) """An implementation of the Strategy pattern, the Scattering Method will take the instrument parameters, and calculate the weights and diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/NeutronInstrument.py b/MDANSE/Src/MDANSE/NeutronInstruments/NeutronInstrument.py index b55c308e10..ed0737cdaa 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/NeutronInstrument.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/NeutronInstrument.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Resolution/__init__.py -# @brief Implements __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/IdealResolution.py b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/IdealResolution.py index 194726059d..6e9f5779b9 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/IdealResolution.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/IdealResolution.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Resolution/IdealResolution.py -# @brief Delta function resolution. No smearing, perfectly sharp. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/Resolution.py b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/Resolution.py index 2ecc3b14ab..df26567603 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/Resolution.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/Resolution.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Resolution/Resolution.py -# @brief Base class for neutron instrument resolution +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/__init__.py index 647f3cb6c9..dca7225518 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Resolution/__init__.py -# @brief Implements __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) """The greatest challenge so far in the realistic neutron instrument implementation, the resolution calculation, will be different for diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/FlatSpectrum.py b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/FlatSpectrum.py index 0bce8e3096..5b1426e018 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/FlatSpectrum.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/FlatSpectrum.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Spectrum/Spectrum.py -# @brief Base class for neutron instrument spectrum +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.Spectrum.Spectrum import Spectrum diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/Spectrum.py b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/Spectrum.py index feb2083d44..807b2e8558 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/Spectrum.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/Spectrum.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Spectrum/Spectrum.py -# @brief Base class for neutron instrument spectrum +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/__init__.py index 986d7e3e55..a99e3bbd3b 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/Spectrum/__init__.py -# @brief Implements __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) """The number of neutrons arriving at the sample in a unit of time will be, necessarily, wavelength-dependent. While on a direct TOF diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/__init__.py index 6a65a7cf55..c4d171386c 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/NeutronInstruments/__init__.py -# @brief Implements __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors RSE Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: RSE Group at ISIS (see AUTHORS) """A new part of the MDANSE code, created in November 2023, the NeutronInstrument section will apply realistic constraints diff --git a/MDANSE/Src/MDANSE/Scripts/__init__.py b/MDANSE/Src/MDANSE/Scripts/__init__.py index e69de29bb2..268c9cc94f 100644 --- a/MDANSE/Src/MDANSE/Scripts/__init__.py +++ b/MDANSE/Src/MDANSE/Scripts/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE. +# +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE/Src/MDANSE/Scripts/mdanse.py b/MDANSE/Src/MDANSE/Scripts/mdanse.py index e6cd183bca..ed4cf689c0 100644 --- a/MDANSE/Src/MDANSE/Scripts/mdanse.py +++ b/MDANSE/Src/MDANSE/Scripts/mdanse.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import pickle import glob diff --git a/MDANSE/Src/MDANSE/Scripts/mdanse_job.py b/MDANSE/Src/MDANSE/Scripts/mdanse_job.py index d36148f4bc..2e26dda663 100644 --- a/MDANSE/Src/MDANSE/Scripts/mdanse_job.py +++ b/MDANSE/Src/MDANSE/Scripts/mdanse_job.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import argparse import sys diff --git a/MDANSE/Src/MDANSE/__init__.py b/MDANSE/Src/MDANSE/__init__.py index 796f5fec3f..7f1936a70b 100644 --- a/MDANSE/Src/MDANSE/__init__.py +++ b/MDANSE/Src/MDANSE/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import warnings diff --git a/MDANSE/Src/MDANSE/__pkginfo__.py b/MDANSE/Src/MDANSE/__pkginfo__.py index 0af304c46c..f2ea4f8c96 100644 --- a/MDANSE/Src/MDANSE/__pkginfo__.py +++ b/MDANSE/Src/MDANSE/__pkginfo__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__pkginfo__.py -# @brief Implements module/class/test __pkginfo__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) __description__ = "Analysis of Molecular Dynamics trajectories" diff --git a/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py b/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py index 8b473dadf4..14082c9165 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/BackEnd.py -# @brief Everything that is not GUI is accessed through the BackEnd +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) import copy from icecream import ic diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/ActionsHolder.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/ActionsHolder.py index 4edaef57fc..c881dd1e6f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/ActionsHolder.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/ActionsHolder.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/DataViewModel/TrajectoryHolder.py -# @brief Subclass of QStandardItemModel for MD trajectories +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) import typing diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobHolder.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobHolder.py index f4e98b4db0..f609de848d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobHolder.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobHolder.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/DataViewModel/JobHolder.py -# @brief Subclass of QStandardItemModel for MDANSE jobs +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from icecream import ic diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobStatusQt.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobStatusQt.py index ca12cdbb50..ddcfe95ad4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobStatusQt.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobStatusQt.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/DataViewModel/JobHolder.py -# @brief Subclass of QStandardItemModel for MDANSE jobs +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from icecream import ic from qtpy.QtCore import QObject, Slot, Signal, QProcess, QThread, QMutex diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/TrajectoryHolder.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/TrajectoryHolder.py index ac267d65ee..bf0670ecec 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/TrajectoryHolder.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/TrajectoryHolder.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/DataViewModel/TrajectoryHolder.py -# @brief Subclass of QStandardItemModel for MD trajectories +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) import hashlib import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py index 0bb47e3c48..643cca110b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py @@ -1,14 +1,18 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/DataViewModel/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/ElementsDatabaseEditor.py b/MDANSE_GUI/Src/MDANSE_GUI/ElementsDatabaseEditor.py index bbb1189cd4..3fc29b7f21 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/ElementsDatabaseEditor.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/ElementsDatabaseEditor.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/PeriodicTableViewer.py -# @brief Shows the chemical element editor. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtWidgets import ( QDialog, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py index a8da3c4c1b..17e85eb762 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Icons/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py index 831ee7613e..0603d9651c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/InputWidgets/InputFileWidget.py -# @brief Implements module/class/test InputFileWidget +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QPushButton, QFileDialog, QComboBox from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py index dc30dc51d3..4e62700864 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE_GUI/InputWidgets/AtomMappingWidget.py -# @brief Implements module/class/test AtomMappingWidget +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import json from collections import defaultdict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py index bed7d3bb13..1bd9a32ef6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py @@ -1,362 +1,366 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/AtomSelectionWidget.py -# @brief Implements module/class/test AtomSelectionWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -from typing import Union, Iterator -from itertools import count, groupby -from qtpy.QtCore import Qt, QEvent, Slot, QObject -from qtpy.QtGui import QStandardItem -from qtpy.QtWidgets import ( - QComboBox, - QLineEdit, - QPushButton, - QDialog, - QCheckBox, - QVBoxLayout, - QHBoxLayout, - QGroupBox, - QLabel, - QTextEdit, -) -from MDANSE.Framework.AtomSelector import Selector -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class CheckableComboBox(QComboBox): - """A multi-select checkable combobox""" - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.setEditable(True) - self.lineEdit().setReadOnly(True) - self.view().viewport().installEventFilter(self) - self.view().setAutoScroll(False) - # it's faster to access the items through this python list than - # through self.model().item(idx) - self._items = [] - self.addItem("select all") - self.lineEdit().setText("") - - def eventFilter(self, a0: Union[QObject, None], a1: Union[QEvent, None]) -> bool: - """Updates the check state of the items and the lineEdit. - - Parameters - ---------- - a0 : QObject or None - A QT object. - a1 : QEvent or None - A QT event. - """ - if a0 == self.view().viewport() and a1.type() == QEvent.MouseButtonRelease: - idx = self.view().indexAt(a1.pos()) - item = self.model().item(idx.row()) - - if item.checkState() == Qt.Checked: - check_uncheck = Qt.Unchecked - else: - check_uncheck = Qt.Checked - - if idx.row() == 0: - # need to block signals temporarily otherwise as we - # need to make a change on all the items which could - # cause alot of signals to be emitted - self.model().blockSignals(True) - for i in self.getItems(): - i.setCheckState(check_uncheck) - self.model().blockSignals(False) - item.setCheckState(check_uncheck) - else: - item.setCheckState(check_uncheck) - # check/uncheck select all since everything is/isn't selected - if all([i.checkState() == Qt.Checked for i in self.getItems()]): - self.model().item(0).setCheckState(Qt.Checked) - else: - self.model().item(0).setCheckState(Qt.Unchecked) - - self.update_line_edit() - return True - - return super().eventFilter(a0, a1) - - def addItems(self, texts: list[str]) -> None: - """ - Parameters - ---------- - texts : list[str] - A list of items texts to add. - """ - for text in texts: - self.addItem(text) - - def configure_using_default(self): - """This is too complex to have a default value""" - - def addItem(self, text: str) -> None: - """ - Parameters - ---------- - text : str - The text of the item to add. - """ - item = QStandardItem() - item.setText(text) - item.setEnabled(True) - item.setCheckable(True) - self.model().appendRow(item) - self._items.append(item) - - def getItems(self) -> Iterator[QStandardItem]: - """ - Yields - ------ - QStandardItem - Yields the items in the combobox except for the zeroth - item because that is the select all item. - """ - for i in range(self.model().rowCount()): - if i == 0: # skips the select all item - continue - yield self._items[i] - - def check_items_castable_to_int(self) -> bool: - """ - Returns - ------- - bool - Returns true if the text of all items can be cast to int. - """ - try: - [int(i.text()) for i in self.getItems()] - return True - except ValueError: - return False - - def update_line_edit(self) -> None: - """Updates the lineEdit text of the combobox.""" - vals = [] - for item in self.getItems(): - if item.checkState() == Qt.Checked: - vals.append(item.text()) - if self.check_items_castable_to_int(): - vals = [int(i) for i in vals] - # changes for example 1,2,3,5,6,7,9,10 -> 1-3,5-7,9-10 - gr = (list(x) for _, x in groupby(vals, lambda x, c=count(): next(c) - x)) - text = ",".join("-".join(map(str, (g[0], g[-1])[: len(g)])) for g in gr) - self.lineEdit().setText(text) - else: - self.lineEdit().setText(",".join(vals)) - - -class HelperDialog(QDialog): - """Generates a string that specifies the atom selection. - - Attributes - ---------- - _cbox_text : dict - The dictionary that maps the selector settings to text used in - the helper dialog. - """ - - _cbox_text = { - "all": "All atoms (excl. dummy atoms):", - "dummy": "All dummy atoms:", - "hs_on_heteroatom": "Hs on heteroatoms:", - "primary_amine": "Primary amine groups:", - "hydroxy": "Hydroxy groups:", - "methyl": "Methyl groups:", - "phosphate": "Phosphate groups:", - "sulphate": "Sulphate groups:", - "thiol": "Thiol groups:", - "water": "Water molecules:", - "element": "Elements:", - "hs_on_element": "Hs on elements:", - "index": "Indexes:", - "invert": "Invert the selection:", - } - - def __init__(self, selector: Selector, field: QLineEdit, parent, *args, **kwargs): - """ - Parameters - ---------- - selector : Selector - The MDANSE selector initialized with the current chemical - system. - field : QLineEdit - The QLineEdit field that will need to be updated when - applying the setting. - """ - super().__init__(parent, *args, **kwargs) - self.setWindowTitle("Atom selection helper") - self.min_width = kwargs.get("min_width", 450) - self.resize(self.min_width, self.height()) - self.setMinimumWidth(self.min_width) - self.selector = selector - self._field = field - self.full_settings = self.selector.full_settings - match_exists = self.selector.match_exists - - self.left = QVBoxLayout() - - select = QGroupBox("selection") - select_layout = QVBoxLayout() - invert = QGroupBox("inversion") - invert_layout = QVBoxLayout() - - self.check_boxes = [] - self.combo_boxes = [] - - for k, v in self.full_settings.items(): - - if isinstance(v, bool): - check_layout = QHBoxLayout() - checkbox = QCheckBox() - checkbox.setChecked(v) - checkbox.setLayoutDirection(Qt.RightToLeft) - label = QLabel(self._cbox_text[k]) - checkbox.setObjectName(k) - checkbox.stateChanged.connect(self.update) - if not match_exists[k]: - checkbox.setEnabled(False) - label.setStyleSheet("color: grey;") - self.check_boxes.append(checkbox) - check_layout.addWidget(label) - check_layout.addWidget(checkbox) - if k == "invert": - invert_layout.addLayout(check_layout) - else: - select_layout.addLayout(check_layout) - - elif isinstance(v, dict): - combo_layout = QHBoxLayout() - combo = CheckableComboBox() - items = [i for i in v.keys() if match_exists[k][i]] - # we blocksignals here as there can be some - # performance issues with a large number of items - combo.model().blockSignals(True) - combo.addItems(items) - combo.model().blockSignals(False) - combo.setObjectName(k) - combo.model().dataChanged.connect(self.update) - label = QLabel(self._cbox_text[k]) - if len(items) == 0: - combo.setEnabled(False) - label.setStyleSheet("color: grey;") - self.combo_boxes.append(combo) - combo_layout.addWidget(label) - combo_layout.addWidget(combo) - select_layout.addLayout(combo_layout) - - select.setLayout(select_layout) - invert.setLayout(invert_layout) - self.left.addWidget(select) - self.left.addWidget(invert) - - bottom = QHBoxLayout() - apply = QPushButton("Apply") - close = QPushButton("Close") - apply.clicked.connect(self.apply) - close.clicked.connect(self.close) - bottom.addWidget(apply) - bottom.addWidget(close) - - self.left.addLayout(bottom) - self.right = QTextEdit() - self.right.setReadOnly(True) - - layout = QHBoxLayout() - layout.addLayout(self.left, 5) - layout.addWidget(self.right, 4) - - self.setLayout(layout) - self.update() - - def update(self) -> None: - """Using the checkbox and combobox widgets: update the settings, - get the selection and update the textedit box with details of - the current selection. - """ - for check_box in self.check_boxes: - self.full_settings[check_box.objectName()] = check_box.isChecked() - for combo_box in self.combo_boxes: - for item in combo_box.getItems(): - self.full_settings[combo_box.objectName()][item.text()] = ( - item.checkState() == Qt.Checked - ) - - self.selector.update_settings(self.full_settings) - idxs = self.selector.get_idxs() - num_sel = len(idxs) - - text = [f"Number of atoms selected:\n{num_sel}\n\nSelected atoms:\n"] - atoms = self.selector.system.atom_list - for idx in idxs: - text.append(f"{idx}) {atoms[idx].full_name}\n") - - self.right.setText("".join(text)) - - def apply(self) -> None: - """Set the field of the AtomSelectionWidget to the currently - chosen setting in this widget. - """ - self.selector.update_settings(self.full_settings) - self._field.setText(self.selector.settings_to_json()) - - -class AtomSelectionWidget(WidgetBase): - """The atoms selection widget.""" - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - default_value = '{"all": true}' - self._value = default_value - self._field = QLineEdit(default_value, self._base) - self._field.setPlaceholderText(default_value) - self._field.setMaxLength(2147483647) # set to the largest possible - self._field.textChanged.connect(self.updateValue) - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "Specify which atoms will be used in the analysis. The input is a JSON string, and can be created using the helper dialog." - self.selector = self._configurator.get_selector() - self.helper = HelperDialog(self.selector, self._field, self._base) - helper_button = QPushButton("Atom selection helper", self._base) - helper_button.clicked.connect(self.helper_dialog) - self._default_value = default_value - self._layout.addWidget(self._field) - self._layout.addWidget(helper_button) - self.update_labels() - self.updateValue() - self._field.setToolTip(tooltip_text) - - @Slot() - def helper_dialog(self) -> None: - """Opens the helper dialog.""" - if self.helper.isVisible(): - self.helper.close() - else: - self.helper.show() - - def get_widget_value(self) -> str: - """ - Returns - ------- - str - The JSON selector setting. - """ - selection_string = self._field.text() - if len(selection_string) < 1: - self._empty = True - return self._default_value - else: - self._empty = False - return selection_string +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +from typing import Union, Iterator +from itertools import count, groupby +from qtpy.QtCore import Qt, QEvent, Slot, QObject +from qtpy.QtGui import QStandardItem +from qtpy.QtWidgets import ( + QComboBox, + QLineEdit, + QPushButton, + QDialog, + QCheckBox, + QVBoxLayout, + QHBoxLayout, + QGroupBox, + QLabel, + QTextEdit, +) +from MDANSE.Framework.AtomSelector import Selector +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class CheckableComboBox(QComboBox): + """A multi-select checkable combobox""" + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.setEditable(True) + self.lineEdit().setReadOnly(True) + self.view().viewport().installEventFilter(self) + self.view().setAutoScroll(False) + # it's faster to access the items through this python list than + # through self.model().item(idx) + self._items = [] + self.addItem("select all") + self.lineEdit().setText("") + + def eventFilter(self, a0: Union[QObject, None], a1: Union[QEvent, None]) -> bool: + """Updates the check state of the items and the lineEdit. + + Parameters + ---------- + a0 : QObject or None + A QT object. + a1 : QEvent or None + A QT event. + """ + if a0 == self.view().viewport() and a1.type() == QEvent.MouseButtonRelease: + idx = self.view().indexAt(a1.pos()) + item = self.model().item(idx.row()) + + if item.checkState() == Qt.Checked: + check_uncheck = Qt.Unchecked + else: + check_uncheck = Qt.Checked + + if idx.row() == 0: + # need to block signals temporarily otherwise as we + # need to make a change on all the items which could + # cause alot of signals to be emitted + self.model().blockSignals(True) + for i in self.getItems(): + i.setCheckState(check_uncheck) + self.model().blockSignals(False) + item.setCheckState(check_uncheck) + else: + item.setCheckState(check_uncheck) + # check/uncheck select all since everything is/isn't selected + if all([i.checkState() == Qt.Checked for i in self.getItems()]): + self.model().item(0).setCheckState(Qt.Checked) + else: + self.model().item(0).setCheckState(Qt.Unchecked) + + self.update_line_edit() + return True + + return super().eventFilter(a0, a1) + + def addItems(self, texts: list[str]) -> None: + """ + Parameters + ---------- + texts : list[str] + A list of items texts to add. + """ + for text in texts: + self.addItem(text) + + def configure_using_default(self): + """This is too complex to have a default value""" + + def addItem(self, text: str) -> None: + """ + Parameters + ---------- + text : str + The text of the item to add. + """ + item = QStandardItem() + item.setText(text) + item.setEnabled(True) + item.setCheckable(True) + self.model().appendRow(item) + self._items.append(item) + + def getItems(self) -> Iterator[QStandardItem]: + """ + Yields + ------ + QStandardItem + Yields the items in the combobox except for the zeroth + item because that is the select all item. + """ + for i in range(self.model().rowCount()): + if i == 0: # skips the select all item + continue + yield self._items[i] + + def check_items_castable_to_int(self) -> bool: + """ + Returns + ------- + bool + Returns true if the text of all items can be cast to int. + """ + try: + [int(i.text()) for i in self.getItems()] + return True + except ValueError: + return False + + def update_line_edit(self) -> None: + """Updates the lineEdit text of the combobox.""" + vals = [] + for item in self.getItems(): + if item.checkState() == Qt.Checked: + vals.append(item.text()) + if self.check_items_castable_to_int(): + vals = [int(i) for i in vals] + # changes for example 1,2,3,5,6,7,9,10 -> 1-3,5-7,9-10 + gr = (list(x) for _, x in groupby(vals, lambda x, c=count(): next(c) - x)) + text = ",".join("-".join(map(str, (g[0], g[-1])[: len(g)])) for g in gr) + self.lineEdit().setText(text) + else: + self.lineEdit().setText(",".join(vals)) + + +class HelperDialog(QDialog): + """Generates a string that specifies the atom selection. + + Attributes + ---------- + _cbox_text : dict + The dictionary that maps the selector settings to text used in + the helper dialog. + """ + + _cbox_text = { + "all": "All atoms (excl. dummy atoms):", + "dummy": "All dummy atoms:", + "hs_on_heteroatom": "Hs on heteroatoms:", + "primary_amine": "Primary amine groups:", + "hydroxy": "Hydroxy groups:", + "methyl": "Methyl groups:", + "phosphate": "Phosphate groups:", + "sulphate": "Sulphate groups:", + "thiol": "Thiol groups:", + "water": "Water molecules:", + "element": "Elements:", + "hs_on_element": "Hs on elements:", + "index": "Indexes:", + "invert": "Invert the selection:", + } + + def __init__(self, selector: Selector, field: QLineEdit, parent, *args, **kwargs): + """ + Parameters + ---------- + selector : Selector + The MDANSE selector initialized with the current chemical + system. + field : QLineEdit + The QLineEdit field that will need to be updated when + applying the setting. + """ + super().__init__(parent, *args, **kwargs) + self.setWindowTitle("Atom selection helper") + self.min_width = kwargs.get("min_width", 450) + self.resize(self.min_width, self.height()) + self.setMinimumWidth(self.min_width) + self.selector = selector + self._field = field + self.full_settings = self.selector.full_settings + match_exists = self.selector.match_exists + + self.left = QVBoxLayout() + + select = QGroupBox("selection") + select_layout = QVBoxLayout() + invert = QGroupBox("inversion") + invert_layout = QVBoxLayout() + + self.check_boxes = [] + self.combo_boxes = [] + + for k, v in self.full_settings.items(): + + if isinstance(v, bool): + check_layout = QHBoxLayout() + checkbox = QCheckBox() + checkbox.setChecked(v) + checkbox.setLayoutDirection(Qt.RightToLeft) + label = QLabel(self._cbox_text[k]) + checkbox.setObjectName(k) + checkbox.stateChanged.connect(self.update) + if not match_exists[k]: + checkbox.setEnabled(False) + label.setStyleSheet("color: grey;") + self.check_boxes.append(checkbox) + check_layout.addWidget(label) + check_layout.addWidget(checkbox) + if k == "invert": + invert_layout.addLayout(check_layout) + else: + select_layout.addLayout(check_layout) + + elif isinstance(v, dict): + combo_layout = QHBoxLayout() + combo = CheckableComboBox() + items = [i for i in v.keys() if match_exists[k][i]] + # we blocksignals here as there can be some + # performance issues with a large number of items + combo.model().blockSignals(True) + combo.addItems(items) + combo.model().blockSignals(False) + combo.setObjectName(k) + combo.model().dataChanged.connect(self.update) + label = QLabel(self._cbox_text[k]) + if len(items) == 0: + combo.setEnabled(False) + label.setStyleSheet("color: grey;") + self.combo_boxes.append(combo) + combo_layout.addWidget(label) + combo_layout.addWidget(combo) + select_layout.addLayout(combo_layout) + + select.setLayout(select_layout) + invert.setLayout(invert_layout) + self.left.addWidget(select) + self.left.addWidget(invert) + + bottom = QHBoxLayout() + apply = QPushButton("Apply") + close = QPushButton("Close") + apply.clicked.connect(self.apply) + close.clicked.connect(self.close) + bottom.addWidget(apply) + bottom.addWidget(close) + + self.left.addLayout(bottom) + self.right = QTextEdit() + self.right.setReadOnly(True) + + layout = QHBoxLayout() + layout.addLayout(self.left, 5) + layout.addWidget(self.right, 4) + + self.setLayout(layout) + self.update() + + def update(self) -> None: + """Using the checkbox and combobox widgets: update the settings, + get the selection and update the textedit box with details of + the current selection. + """ + for check_box in self.check_boxes: + self.full_settings[check_box.objectName()] = check_box.isChecked() + for combo_box in self.combo_boxes: + for item in combo_box.getItems(): + self.full_settings[combo_box.objectName()][item.text()] = ( + item.checkState() == Qt.Checked + ) + + self.selector.update_settings(self.full_settings) + idxs = self.selector.get_idxs() + num_sel = len(idxs) + + text = [f"Number of atoms selected:\n{num_sel}\n\nSelected atoms:\n"] + atoms = self.selector.system.atom_list + for idx in idxs: + text.append(f"{idx}) {atoms[idx].full_name}\n") + + self.right.setText("".join(text)) + + def apply(self) -> None: + """Set the field of the AtomSelectionWidget to the currently + chosen setting in this widget. + """ + self.selector.update_settings(self.full_settings) + self._field.setText(self.selector.settings_to_json()) + + +class AtomSelectionWidget(WidgetBase): + """The atoms selection widget.""" + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + default_value = '{"all": true}' + self._value = default_value + self._field = QLineEdit(default_value, self._base) + self._field.setPlaceholderText(default_value) + self._field.setMaxLength(2147483647) # set to the largest possible + self._field.textChanged.connect(self.updateValue) + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "Specify which atoms will be used in the analysis. The input is a JSON string, and can be created using the helper dialog." + self.selector = self._configurator.get_selector() + self.helper = HelperDialog(self.selector, self._field, self._base) + helper_button = QPushButton("Atom selection helper", self._base) + helper_button.clicked.connect(self.helper_dialog) + self._default_value = default_value + self._layout.addWidget(self._field) + self._layout.addWidget(helper_button) + self.update_labels() + self.updateValue() + self._field.setToolTip(tooltip_text) + + @Slot() + def helper_dialog(self) -> None: + """Opens the helper dialog.""" + if self.helper.isVisible(): + self.helper.close() + else: + self.helper.show() + + def get_widget_value(self) -> str: + """ + Returns + ------- + str + The JSON selector setting. + """ + selection_string = self._field.text() + if len(selection_string) < 1: + self._empty = True + return self._default_value + else: + self._empty = False + return selection_string diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py index 2032f0103e..2d67eff4a7 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py @@ -1,63 +1,67 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/AtomTransmutationWidget.py -# @brief Implements module/class/test AtomTransmutationWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -import glob -import itertools -import os -import os.path - -from qtpy.QtWidgets import QHBoxLayout, QLabel, QLineEdit, QPushButton, QWidget -from qtpy.QtCore import Qt, Slot -from qtpy.QtGui import QStandardItemModel, QStandardItem - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase -from MDANSE_GUI.InputWidgets.AtomSelectionWidget import AtomSelectionWidget - - -class AtomTransmutationWidget(WidgetBase): - def __init__(self, *args, **kwargs): - kwargs["layout_type"] = "QVBoxLayout" - super().__init__(*args, **kwargs) - newline_button = QPushButton("Add transmutation", self._base) - self._layout.addWidget(newline_button) - self._lines = [] - self.updateValue() - - def add_line(self): - line_base = QWidget(self._base) - line_layout = QHBoxLayout(line_base) - line_base.setLayout(line_layout) - default_value = "all" - starter = QLabel("Transmute ", line_base) - leftfield = QLineEdit(default_value, self._base) - spacer = QLabel(" to ", line_base) - rightfield = QLineEdit("Au", self._base) - for wid in [starter, leftfield, spacer, rightfield]: - line_layout.append(wid) - self._lines.append({"from": leftfield, "to": rightfield}) - - def configure_using_default(self): - """This is too complex to have a default value""" - - def get_widget_value(self): - result = [] - for line in self._lines: - result.append((line["from"], line["to"])) - if len(result) == 0: - self._empty = True - return None - self._empty = False - return result +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +import glob +import itertools +import os +import os.path + +from qtpy.QtWidgets import QHBoxLayout, QLabel, QLineEdit, QPushButton, QWidget +from qtpy.QtCore import Qt, Slot +from qtpy.QtGui import QStandardItemModel, QStandardItem + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase +from MDANSE_GUI.InputWidgets.AtomSelectionWidget import AtomSelectionWidget + + +class AtomTransmutationWidget(WidgetBase): + def __init__(self, *args, **kwargs): + kwargs["layout_type"] = "QVBoxLayout" + super().__init__(*args, **kwargs) + newline_button = QPushButton("Add transmutation", self._base) + self._layout.addWidget(newline_button) + self._lines = [] + self.updateValue() + + def add_line(self): + line_base = QWidget(self._base) + line_layout = QHBoxLayout(line_base) + line_base.setLayout(line_layout) + default_value = "all" + starter = QLabel("Transmute ", line_base) + leftfield = QLineEdit(default_value, self._base) + spacer = QLabel(" to ", line_base) + rightfield = QLineEdit("Au", self._base) + for wid in [starter, leftfield, spacer, rightfield]: + line_layout.append(wid) + self._lines.append({"from": leftfield, "to": rightfield}) + + def configure_using_default(self): + """This is too complex to have a default value""" + + def get_widget_value(self): + result = [] + for line in self._lines: + result.append((line["from"], line["to"])) + if len(result) == 0: + self._empty = True + return None + self._empty = False + return result diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py index 5fc9e87402..dc4f0dfce6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/InputWidgets/BackupWidget.py -# @brief BackupWidget is used when a specialised widget is missing +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from icecream import ic from qtpy.QtWidgets import QLineEdit diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py index e4f3ffff0b..6291835147 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py @@ -1,56 +1,60 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/BooleanWidget.py -# @brief Implements module/class/test BooleanWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QCheckBox -from qtpy.QtCore import Slot, Qt - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class BooleanWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - default_option = self._configurator.default - field = QCheckBox(self._base) - field.setTristate(False) - field.setChecked(default_option) - field.stateChanged.connect(self.updateValue) - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "A single logical value that can be True of False" - field.setToolTip(tooltip_text) - self._field = field - self._layout.addWidget(field) - self.default_labels() - self.update_labels() - self.updateValue() - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "BooleanWidget" - if self._tooltip == "": - self._tooltip = "A single logical value that can be True of False" - self._field.setToolTip(self._tooltip) - - def configure_using_default(self): - """No need to anything for Boolean""" - - def get_widget_value(self): - return self._field.checkState() == Qt.CheckState.Checked +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QCheckBox +from qtpy.QtCore import Slot, Qt + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class BooleanWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + default_option = self._configurator.default + field = QCheckBox(self._base) + field.setTristate(False) + field.setChecked(default_option) + field.stateChanged.connect(self.updateValue) + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "A single logical value that can be True of False" + field.setToolTip(tooltip_text) + self._field = field + self._layout.addWidget(field) + self.default_labels() + self.update_labels() + self.updateValue() + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "BooleanWidget" + if self._tooltip == "": + self._tooltip = "A single logical value that can be True of False" + self._field.setToolTip(self._tooltip) + + def configure_using_default(self): + """No need to anything for Boolean""" + + def get_widget_value(self): + return self._field.checkState() == Qt.CheckState.Checked diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py index 65f39b0e92..173cf6c69b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py @@ -1,63 +1,67 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/SingleChoiceWidget.py -# @brief Implements module/class/test SingleChoiceWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QComboBox -from qtpy.QtCore import Slot - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class ComboWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - configurator = kwargs.get("configurator", None) - if configurator is None: - option_list = kwargs.get("choices", []) - else: - option_list = configurator.choices - default_option = configurator.default - field = QComboBox(self._base) - field.addItems(option_list) - field.setCurrentText(default_option) - field.currentTextChanged.connect(self.updateValue) - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = ( - "A single option can be picked out of all the options listed." - ) - field.setToolTip(tooltip_text) - self._field = field - self._layout.addWidget(field) - self._configurator = configurator - self.default_labels() - self.update_labels() - self.updateValue() - - def configure_using_default(self): - """This is too complex to have a default value""" - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "ComboWidget" - if self._tooltip == "": - self._tooltip = "You only have one option. Choose wisely." - - def get_widget_value(self): - return self._field.currentText() +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QComboBox +from qtpy.QtCore import Slot + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class ComboWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + configurator = kwargs.get("configurator", None) + if configurator is None: + option_list = kwargs.get("choices", []) + else: + option_list = configurator.choices + default_option = configurator.default + field = QComboBox(self._base) + field.addItems(option_list) + field.setCurrentText(default_option) + field.currentTextChanged.connect(self.updateValue) + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = ( + "A single option can be picked out of all the options listed." + ) + field.setToolTip(tooltip_text) + self._field = field + self._layout.addWidget(field) + self._configurator = configurator + self.default_labels() + self.update_labels() + self.updateValue() + + def configure_using_default(self): + """This is too complex to have a default value""" + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "ComboWidget" + if self._tooltip == "": + self._tooltip = "You only have one option. Choose wisely." + + def get_widget_value(self): + return self._field.currentText() diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py index 2cc468a872..b716106b5b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/InputWidgets/HDFTrajectoryWidget.py -# @brief Implements module/class/test HDFTrajectoryWidget +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py index a9e7e857ad..3e859a8c3f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py @@ -1,82 +1,86 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/FloatWidget.py -# @brief Implements module/class/test FloatWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QLineEdit, QDoubleSpinBox -from qtpy.QtCore import Slot, Signal -from qtpy.QtGui import QDoubleValidator - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class FloatWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - try: - default_option = float(self._configurator.default) - except ValueError: - default_option = 0.0 - if self._configurator.choices: - field = QDoubleSpinBox(self._base) - field.setMinimum(self._configurator.choices[0]) - field.setMaximum(self._configurator.choices[-1]) - if len(self._configurator.choices) > 1: - field.setSingleStep( - self._configurator.choices[1] - self._configurator.choices[0] - ) - field.setValue(default_option) - else: - field = QLineEdit(self._base) - validator = QDoubleValidator(field) - minval, maxval = self._configurator.mini, self._configurator.maxi - if minval is not None: - validator.setBottom(minval) - if maxval is not None: - validator.setTop(maxval) - field.setValidator(validator) - field.setText(str(default_option)) - field.textChanged.connect(self.updateValue) - field.setPlaceholderText(str(default_option)) - field.setToolTip(self._tooltip) - self._layout.addWidget(field) - self._field = field - self._default_value = default_option - self.default_labels() - self.update_labels() - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "A single floating-point number" - field.setToolTip(tooltip_text) - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "FloatWidget" - if self._tooltip == "": - self._tooltip = "A single floating-point number" - - def get_widget_value(self): - """Collect the results from the input widgets and return the value.""" - strval = self._field.text().strip() - if len(strval) < 1: - self._empty = True - return self._default_value - else: - self._empty = False - return strval +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QLineEdit, QDoubleSpinBox +from qtpy.QtCore import Slot, Signal +from qtpy.QtGui import QDoubleValidator + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class FloatWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + try: + default_option = float(self._configurator.default) + except ValueError: + default_option = 0.0 + if self._configurator.choices: + field = QDoubleSpinBox(self._base) + field.setMinimum(self._configurator.choices[0]) + field.setMaximum(self._configurator.choices[-1]) + if len(self._configurator.choices) > 1: + field.setSingleStep( + self._configurator.choices[1] - self._configurator.choices[0] + ) + field.setValue(default_option) + else: + field = QLineEdit(self._base) + validator = QDoubleValidator(field) + minval, maxval = self._configurator.mini, self._configurator.maxi + if minval is not None: + validator.setBottom(minval) + if maxval is not None: + validator.setTop(maxval) + field.setValidator(validator) + field.setText(str(default_option)) + field.textChanged.connect(self.updateValue) + field.setPlaceholderText(str(default_option)) + field.setToolTip(self._tooltip) + self._layout.addWidget(field) + self._field = field + self._default_value = default_option + self.default_labels() + self.update_labels() + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "A single floating-point number" + field.setToolTip(tooltip_text) + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "FloatWidget" + if self._tooltip == "": + self._tooltip = "A single floating-point number" + + def get_widget_value(self): + """Collect the results from the input widgets and return the value.""" + strval = self._field.text().strip() + if len(strval) < 1: + self._empty = True + return self._default_value + else: + self._empty = False + return strval diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py index db7cca6479..e84995b9f4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py @@ -1,98 +1,102 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/FramesWidget.py -# @brief Implements module/class/test FramesWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel -from qtpy.QtCore import Slot, Signal -from qtpy.QtGui import QIntValidator - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class FramesWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, layout_type="QGridLayout", **kwargs) - trajectory_configurator = kwargs.get("trajectory_configurator", None) - if trajectory_configurator is not None: - try: - self._last_frame = trajectory_configurator["length"] - except: - self._last_frame = -1 - else: - self._last_frame = -1 - labels = [ - QLabel("First frame", self._base), - QLabel("Last frame", self._base), - QLabel("in steps of", self._base), - ] - fields = [ - QLineEdit("0", self._base), - QLineEdit(str(self._last_frame), self._base), - QLineEdit("1", self._base), - ] - placeholders = ["0", str(self._last_frame), "1"] - validators = [QIntValidator(parent_field) for parent_field in fields] - for field_num in range(3): - self._layout.addWidget(labels[field_num], 0, 2 * field_num) - self._layout.addWidget(fields[field_num], 0, 2 * field_num + 1) - fields[field_num].setValidator(validators[field_num]) - fields[field_num].textChanged.connect(self.updateValue) - fields[field_num].setPlaceholderText(placeholders[field_num]) - self._fields = fields - self._validators = validators - self._default_values = placeholders - self.default_labels() - self.update_labels() - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "A single logical value that can be True of False" - for field in fields: - field.setToolTip(tooltip_text) - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "FramesWidget" - if self._tooltip == "": - self._tooltip = ( - "Trajectory frames to be used, given as (First, Last, StepSize)" - ) - - def value_from_configurator(self): - if self._last_frame > 0: - for val in self._validators: - val.setBottom(-abs(self._last_frame)) - val.setTop(abs(self._last_frame)) - elif self._configurator.check_dependencies(): - minval, maxval = self._configurator._mini, self._configurator._maxi - print(f"Configurator min/max: {minval}, {maxval}") - for val in self._validators: - val.setBottom(-abs(maxval)) - val.setTop(abs(maxval)) - - def get_widget_value(self): - result = [] - for n, field in enumerate(self._fields): - strval = field.text() - try: - val = int(strval) - except: - val = int(self._default_values[n]) - result.append(val) - return result +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel +from qtpy.QtCore import Slot, Signal +from qtpy.QtGui import QIntValidator + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class FramesWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, layout_type="QGridLayout", **kwargs) + trajectory_configurator = kwargs.get("trajectory_configurator", None) + if trajectory_configurator is not None: + try: + self._last_frame = trajectory_configurator["length"] + except: + self._last_frame = -1 + else: + self._last_frame = -1 + labels = [ + QLabel("First frame", self._base), + QLabel("Last frame", self._base), + QLabel("in steps of", self._base), + ] + fields = [ + QLineEdit("0", self._base), + QLineEdit(str(self._last_frame), self._base), + QLineEdit("1", self._base), + ] + placeholders = ["0", str(self._last_frame), "1"] + validators = [QIntValidator(parent_field) for parent_field in fields] + for field_num in range(3): + self._layout.addWidget(labels[field_num], 0, 2 * field_num) + self._layout.addWidget(fields[field_num], 0, 2 * field_num + 1) + fields[field_num].setValidator(validators[field_num]) + fields[field_num].textChanged.connect(self.updateValue) + fields[field_num].setPlaceholderText(placeholders[field_num]) + self._fields = fields + self._validators = validators + self._default_values = placeholders + self.default_labels() + self.update_labels() + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "A single logical value that can be True of False" + for field in fields: + field.setToolTip(tooltip_text) + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "FramesWidget" + if self._tooltip == "": + self._tooltip = ( + "Trajectory frames to be used, given as (First, Last, StepSize)" + ) + + def value_from_configurator(self): + if self._last_frame > 0: + for val in self._validators: + val.setBottom(-abs(self._last_frame)) + val.setTop(abs(self._last_frame)) + elif self._configurator.check_dependencies(): + minval, maxval = self._configurator._mini, self._configurator._maxi + print(f"Configurator min/max: {minval}, {maxval}") + for val in self._validators: + val.setBottom(-abs(maxval)) + val.setTop(abs(maxval)) + + def get_widget_value(self): + result = [] + for n, field in enumerate(self._fields): + strval = field.text() + try: + val = int(strval) + except: + val = int(self._default_values[n]) + result.append(val) + return result diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py index 32930e0db8..b75bafdf36 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py @@ -1,65 +1,69 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py -# @brief Implements module/class/test HDFTrajectoryWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -import os - -from qtpy.QtWidgets import QLabel - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class HDFTrajectoryWidget(WidgetBase): - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - source_object = kwargs.get("source_object", None) - try: - filename = source_object - except AttributeError: - filename = None - if filename is not None: - self._configurator.configure(filename) - label = QLabel(filename, self._base) - self._layout.addWidget(label) - trajectory_path, _ = os.path.split(filename) - self.default_path = trajectory_path - else: - label = QLabel("No Trajectory available", self._base) - self._layout.addWidget(label) - self.default_labels() - self.update_labels() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "A single logical value that can be True of False" - label.setToolTip(tooltip_text) - - def configure_using_default(self): - """This is too static to have a default value""" - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "HDFTrajectoryWidget" - if self._tooltip == "": - self._tooltip = "The input trajectory to be processed" - - def get_value(self): - return self._configurator["value"] - - def get_widget_value(self): - return self.get_value() +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +import os + +from qtpy.QtWidgets import QLabel + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class HDFTrajectoryWidget(WidgetBase): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + source_object = kwargs.get("source_object", None) + try: + filename = source_object + except AttributeError: + filename = None + if filename is not None: + self._configurator.configure(filename) + label = QLabel(filename, self._base) + self._layout.addWidget(label) + trajectory_path, _ = os.path.split(filename) + self.default_path = trajectory_path + else: + label = QLabel("No Trajectory available", self._base) + self._layout.addWidget(label) + self.default_labels() + self.update_labels() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "A single logical value that can be True of False" + label.setToolTip(tooltip_text) + + def configure_using_default(self): + """This is too static to have a default value""" + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "HDFTrajectoryWidget" + if self._tooltip == "": + self._tooltip = "The input trajectory to be processed" + + def get_value(self): + return self._configurator["value"] + + def get_widget_value(self): + return self.get_value() diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py index 02c430f7d6..1c9399e81f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py @@ -1,27 +1,31 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/InputDirectoryWidget.py -# @brief Implements module/class/test InputDirectoryWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QFileDialog - -from MDANSE_GUI.InputWidgets.InputFileWidget import InputFileWidget - - -class InputDirectoryWidget(InputFileWidget): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self._file_dialog = QFileDialog.getExistingDirectory - - def configure_using_default(self): - """This is too specific to have a default value""" +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QFileDialog + +from MDANSE_GUI.InputWidgets.InputFileWidget import InputFileWidget + + +class InputDirectoryWidget(InputFileWidget): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._file_dialog = QFileDialog.getExistingDirectory + + def configure_using_default(self): + """This is too specific to have a default value""" diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py index da21a7520a..5e73ac9fb6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py @@ -1,93 +1,97 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/InputFileWidget.py -# @brief Implements module/class/test InputFileWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QLineEdit, QPushButton, QFileDialog -from qtpy.QtCore import Slot - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase -from MDANSE_GUI.Widgets.GeneralWidgets import translate_file_associations - - -class InputFileWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - configurator = kwargs.get("configurator", None) - if configurator is not None: - default_value = configurator.default - else: - default_value = "" - try: - parent = kwargs.get("parent", None) - self.default_path = parent.default_path - except KeyError: - self.default_path = "." - print("KeyError in InputFileWidget - can't get default path.") - except AttributeError: - self.default_path = "." - print("AttributeError in InputFileWidget - can't get default path.") - default_value = kwargs.get("default", "") - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "Specify a path to an existing file." - try: - file_association = configurator.wildcard - except AttributeError: - file_association = kwargs.get("wildcard", "") - self._qt_file_association = translate_file_associations(file_association) - field = QLineEdit(self._base) - self._field = field - field.textChanged.connect(self.updateValue) - field.setText(str(default_value)) - field.setPlaceholderText(str(default_value)) - field.setToolTip(tooltip_text) - self._layout.addWidget(field) - button = QPushButton("Browse", self._base) - button.clicked.connect(self.valueFromDialog) - self._default_value = default_value - self._layout.addWidget(button) - self._configurator = configurator - self._file_dialog = QFileDialog.getOpenFileName - self.updateValue() - - def configure_using_default(self): - """This is too specific to have a default value""" - - @Slot() - def valueFromDialog(self): - """A Slot defined to allow the GUI to be updated based on - the new path received from a FileDialog. - This will start a FileDialog, take the resulting path, - and emit a signal to update the value show by the GUI. - """ - new_value = self._file_dialog( - self.parent(), # the parent of the dialog - "Load a file", # the label of the window - self.default_path, # the initial search path - self._qt_file_association, # text string specifying the file name filter. - ) - if new_value is not None: - self._field.setText(new_value[0]) - self.updateValue() - - def get_widget_value(self): - """Collect the results from the input widgets and return the value.""" - strval = self._field.text() - if len(strval) < 1: - self._empty = True - return self._default_value - else: - self._empty = False - return strval +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QLineEdit, QPushButton, QFileDialog +from qtpy.QtCore import Slot + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase +from MDANSE_GUI.Widgets.GeneralWidgets import translate_file_associations + + +class InputFileWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + configurator = kwargs.get("configurator", None) + if configurator is not None: + default_value = configurator.default + else: + default_value = "" + try: + parent = kwargs.get("parent", None) + self.default_path = parent.default_path + except KeyError: + self.default_path = "." + print("KeyError in InputFileWidget - can't get default path.") + except AttributeError: + self.default_path = "." + print("AttributeError in InputFileWidget - can't get default path.") + default_value = kwargs.get("default", "") + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "Specify a path to an existing file." + try: + file_association = configurator.wildcard + except AttributeError: + file_association = kwargs.get("wildcard", "") + self._qt_file_association = translate_file_associations(file_association) + field = QLineEdit(self._base) + self._field = field + field.textChanged.connect(self.updateValue) + field.setText(str(default_value)) + field.setPlaceholderText(str(default_value)) + field.setToolTip(tooltip_text) + self._layout.addWidget(field) + button = QPushButton("Browse", self._base) + button.clicked.connect(self.valueFromDialog) + self._default_value = default_value + self._layout.addWidget(button) + self._configurator = configurator + self._file_dialog = QFileDialog.getOpenFileName + self.updateValue() + + def configure_using_default(self): + """This is too specific to have a default value""" + + @Slot() + def valueFromDialog(self): + """A Slot defined to allow the GUI to be updated based on + the new path received from a FileDialog. + This will start a FileDialog, take the resulting path, + and emit a signal to update the value show by the GUI. + """ + new_value = self._file_dialog( + self.parent(), # the parent of the dialog + "Load a file", # the label of the window + self.default_path, # the initial search path + self._qt_file_association, # text string specifying the file name filter. + ) + if new_value is not None: + self._field.setText(new_value[0]) + self.updateValue() + + def get_widget_value(self): + """Collect the results from the input widgets and return the value.""" + strval = self._field.text() + if len(strval) < 1: + self._empty = True + return self._default_value + else: + self._empty = False + return strval diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py index 629c17468c..545066aa27 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py @@ -1,144 +1,148 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/InstrumentResolutionWidget.py -# @brief Implements module/class/test InstrumentResolutionWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from qtpy.QtWidgets import ( - QHBoxLayout, - QLabel, - QLineEdit, - QPushButton, - QWidget, - QComboBox, -) -from qtpy.QtCore import Qt, Slot -from qtpy.QtGui import QDoubleValidator - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -init_parameters = { - "ideal": {}, - "Gaussian": {"mu": 0.0, "sigma": 1.0}, - "Lorentzian": {"mu": 0.0, "sigma": 1.0}, - "triangular": {"mu": 0.0, "sigma": 1.0}, - "square": {"mu": 0.0, "sigma": 1.0}, - "pseudo-Voigt": { - "mu_gaussian": 0.0, - "sigma_gaussian": 1.0, - "eta": 0.5, - "mu_lorentzian": 0.0, - "sigma_lorentzian": 1.0, - }, -} - - -widget_text_map = { - "ideal": "ideal", - "Gaussian": "gaussian", - "Lorentzian": "lorentzian", - "triangular": "triangular", - "square": "square", - "pseudo-Voigt": "pseudovoigt", -} - - -class InstrumentResolutionWidget(WidgetBase): - def __init__(self, *args, **kwargs): - kwargs["layout_type"] = "QGridLayout" - super().__init__(*args, **kwargs) - self._layout.addWidget(QLabel("Resolution function", self._base), 0, 0) - self._type_combo = QComboBox(parent=self._base) - self._layout.addWidget(self._type_combo, 0, 1) - self._labels = [] - self._fields = [] - self._defaults = [] - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "The peak function used for smearing/smooting the results. Pick 'ideal' for no smearing." - # first row - for num in range(1, 3): - label = QLabel("", parent=self._base) - field = QLineEdit("0.0", parent=self._base) - field.setEnabled(False) - self._layout.addWidget(label, 0, 2 * num) - self._layout.addWidget(field, 0, 2 * num + 1) - self._labels.append(label) - self._fields.append(field) - val = QDoubleValidator(field) - field.setValidator(val) - self._defaults.append(0.0) - # first row - for num in range(0, 3): - label = QLabel("", parent=self._base) - field = QLineEdit("0.0", parent=self._base) - field.setEnabled(False) - self._layout.addWidget(label, 1, 2 * num) - self._layout.addWidget(field, 1, 2 * num + 1) - self._labels.append(label) - self._fields.append(field) - val = QDoubleValidator(field) - if num == 0: # this is the pseudoVoigt eta - val.setBottom(0.0) - val.setTop(1.0) - field.setValidator(val) - self._defaults.append(0.0) - self._type_combo.addItems([str(x) for x in init_parameters.keys()]) - self._type_combo.setEditable(False) - self._type_combo.currentTextChanged.connect(self.change_function) - for field in self._fields: - field.textChanged.connect(self.updateValue) - field.setToolTip(tooltip_text) - self.updateValue() - - def configure_using_default(self): - """This is too complex to have a default value""" - - @Slot(str) - def change_function(self, function: str): - new_params = init_parameters[function] - np = list(new_params.items()) - for index in range(5): - try: - kv = np[index] - self._fields[index].setEnabled(True) - self._labels[index].setText(str(kv[0])) - self._fields[index].setText(str(kv[1])) - self._fields[index].setPlaceholderText(str(kv[1])) - self._defaults[index] = float(kv[1]) - except IndexError: - self._labels[index].setText("") - self._fields[index].setText("") - self._fields[index].setPlaceholderText("N/A") - self._fields[index].setEnabled(False) - self._defaults[index] = 0.0 - - def get_widget_value(self): - function = widget_text_map[self._type_combo.currentText()] - params = {} - for index in range(5): - key = self._labels[index].text() - if len(key) > 0: - try: - value = float(self._fields[index].text()) - except ValueError: - value = self._defaults[index] - self._fields[index].setStyleSheet( - "background-color:rgb(180,20,180); font-weight: bold" - ) - else: - self._fields[index].setStyleSheet("") - params[key] = value - return (function, params) +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from qtpy.QtWidgets import ( + QHBoxLayout, + QLabel, + QLineEdit, + QPushButton, + QWidget, + QComboBox, +) +from qtpy.QtCore import Qt, Slot +from qtpy.QtGui import QDoubleValidator + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +init_parameters = { + "ideal": {}, + "Gaussian": {"mu": 0.0, "sigma": 1.0}, + "Lorentzian": {"mu": 0.0, "sigma": 1.0}, + "triangular": {"mu": 0.0, "sigma": 1.0}, + "square": {"mu": 0.0, "sigma": 1.0}, + "pseudo-Voigt": { + "mu_gaussian": 0.0, + "sigma_gaussian": 1.0, + "eta": 0.5, + "mu_lorentzian": 0.0, + "sigma_lorentzian": 1.0, + }, +} + + +widget_text_map = { + "ideal": "ideal", + "Gaussian": "gaussian", + "Lorentzian": "lorentzian", + "triangular": "triangular", + "square": "square", + "pseudo-Voigt": "pseudovoigt", +} + + +class InstrumentResolutionWidget(WidgetBase): + def __init__(self, *args, **kwargs): + kwargs["layout_type"] = "QGridLayout" + super().__init__(*args, **kwargs) + self._layout.addWidget(QLabel("Resolution function", self._base), 0, 0) + self._type_combo = QComboBox(parent=self._base) + self._layout.addWidget(self._type_combo, 0, 1) + self._labels = [] + self._fields = [] + self._defaults = [] + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "The peak function used for smearing/smooting the results. Pick 'ideal' for no smearing." + # first row + for num in range(1, 3): + label = QLabel("", parent=self._base) + field = QLineEdit("0.0", parent=self._base) + field.setEnabled(False) + self._layout.addWidget(label, 0, 2 * num) + self._layout.addWidget(field, 0, 2 * num + 1) + self._labels.append(label) + self._fields.append(field) + val = QDoubleValidator(field) + field.setValidator(val) + self._defaults.append(0.0) + # first row + for num in range(0, 3): + label = QLabel("", parent=self._base) + field = QLineEdit("0.0", parent=self._base) + field.setEnabled(False) + self._layout.addWidget(label, 1, 2 * num) + self._layout.addWidget(field, 1, 2 * num + 1) + self._labels.append(label) + self._fields.append(field) + val = QDoubleValidator(field) + if num == 0: # this is the pseudoVoigt eta + val.setBottom(0.0) + val.setTop(1.0) + field.setValidator(val) + self._defaults.append(0.0) + self._type_combo.addItems([str(x) for x in init_parameters.keys()]) + self._type_combo.setEditable(False) + self._type_combo.currentTextChanged.connect(self.change_function) + for field in self._fields: + field.textChanged.connect(self.updateValue) + field.setToolTip(tooltip_text) + self.updateValue() + + def configure_using_default(self): + """This is too complex to have a default value""" + + @Slot(str) + def change_function(self, function: str): + new_params = init_parameters[function] + np = list(new_params.items()) + for index in range(5): + try: + kv = np[index] + self._fields[index].setEnabled(True) + self._labels[index].setText(str(kv[0])) + self._fields[index].setText(str(kv[1])) + self._fields[index].setPlaceholderText(str(kv[1])) + self._defaults[index] = float(kv[1]) + except IndexError: + self._labels[index].setText("") + self._fields[index].setText("") + self._fields[index].setPlaceholderText("N/A") + self._fields[index].setEnabled(False) + self._defaults[index] = 0.0 + + def get_widget_value(self): + function = widget_text_map[self._type_combo.currentText()] + params = {} + for index in range(5): + key = self._labels[index].text() + if len(key) > 0: + try: + value = float(self._fields[index].text()) + except ValueError: + value = self._defaults[index] + self._fields[index].setStyleSheet( + "background-color:rgb(180,20,180); font-weight: bold" + ) + else: + self._fields[index].setStyleSheet("") + params[key] = value + return (function, params) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py index 6f59aaa5e4..4eef933419 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py @@ -1,78 +1,82 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/IntegerWidget.py -# @brief Implements module/class/test IntegerWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - - -from qtpy.QtWidgets import QLineEdit, QSpinBox -from qtpy.QtCore import Slot, Signal -from qtpy.QtGui import QIntValidator - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class IntegerWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - try: - default_option = int(self._configurator.default) - except ValueError: - default_option = 0 - if self._configurator.choices: - field = QSpinBox(self._base) - field.setMinimum(self._configurator.choices[0]) - field.setMaximum(self._configurator.choices[-1]) - field.setValue(default_option) - else: - field = QLineEdit(self._base) - validator = QIntValidator(field) - minval, maxval = self._configurator.mini, self._configurator.maxi - if minval is not None: - validator.setBottom(minval) - if maxval is not None: - validator.setTop(maxval) - field.setValidator(validator) - field.setText(str(default_option)) - field.setPlaceholderText(str(default_option)) - field.textChanged.connect(self.updateValue) - self._field = field - self._default_value = default_option - self._layout.addWidget(field) - self.default_labels() - self.update_labels() - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "A single integer number" - field.setToolTip(tooltip_text) - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "IntegerWidget" - if self._tooltip == "": - self._tooltip = "A single integer number" - - def get_widget_value(self): - """Collect the results from the input widgets and return the value.""" - strval = self._field.text().strip() - if len(strval) < 1: - self._empty = True - return self._default_value - else: - self._empty = False - return strval +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + + +from qtpy.QtWidgets import QLineEdit, QSpinBox +from qtpy.QtCore import Slot, Signal +from qtpy.QtGui import QIntValidator + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class IntegerWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + try: + default_option = int(self._configurator.default) + except ValueError: + default_option = 0 + if self._configurator.choices: + field = QSpinBox(self._base) + field.setMinimum(self._configurator.choices[0]) + field.setMaximum(self._configurator.choices[-1]) + field.setValue(default_option) + else: + field = QLineEdit(self._base) + validator = QIntValidator(field) + minval, maxval = self._configurator.mini, self._configurator.maxi + if minval is not None: + validator.setBottom(minval) + if maxval is not None: + validator.setTop(maxval) + field.setValidator(validator) + field.setText(str(default_option)) + field.setPlaceholderText(str(default_option)) + field.textChanged.connect(self.updateValue) + self._field = field + self._default_value = default_option + self._layout.addWidget(field) + self.default_labels() + self.update_labels() + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "A single integer number" + field.setToolTip(tooltip_text) + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "IntegerWidget" + if self._tooltip == "": + self._tooltip = "A single integer number" + + def get_widget_value(self): + """Collect the results from the input widgets and return the value.""" + strval = self._field.text().strip() + if len(strval) < 1: + self._empty = True + return self._default_value + else: + self._empty = False + return strval diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py index a31accc89a..c940acb4f8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py @@ -1,80 +1,84 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/InterpolationOrderWidget.py -# @brief Implements module/class/test InterpolationOrderWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QSpinBox, QLabel -from qtpy.QtCore import Slot, Signal -from qtpy.QtGui import QIntValidator - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -suffix_dict = { - "0": "th order - no interpolation", - "1": "st order", - "2": "nd order", - "3": "rd order", - "4": "th order", - "5": "th order", -} - - -class InterpolationOrderWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, layout_type="QHBoxLayout", **kwargs) - source_object = kwargs.get("source_object", None) - - self._field = QSpinBox(self._base) - self._field.setValue(1) - label = QLabel("Interpolation order", self._base) - self.numerator = QLabel("st order") - - self._field.valueChanged.connect(self.adjust_numerator) - - self._layout.addWidget(label) - self._layout.addWidget(self._field) - self._layout.addWidget(self.numerator) - self.default_labels() - self.update_labels() - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "The order of the polynomial function used for interpolating velocity values from atom positions. If zero, velocity values present in the trajectory will be used." - self._field.setToolTip(tooltip_text) - self.numerator.setToolTip(tooltip_text) - - def configure_using_default(self): - """This is too simple to have a default value""" - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "InterpolationOrderWidget" - if self._tooltip == "": - self._tooltip = "The order of the polynomial function used for interpolating velocity values from atom positions. If zero, velocity values present in the trajectory will be used." - - @Slot(int) - def adjust_numerator(self, order: int): - text_order = str(order) - new_numerator = suffix_dict.get(text_order[-1], " - no interpolation") - self.numerator.setText(new_numerator) - - def get_widget_value(self): - value = self._field.value() - - return value +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QSpinBox, QLabel +from qtpy.QtCore import Slot, Signal +from qtpy.QtGui import QIntValidator + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +suffix_dict = { + "0": "th order - no interpolation", + "1": "st order", + "2": "nd order", + "3": "rd order", + "4": "th order", + "5": "th order", +} + + +class InterpolationOrderWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, layout_type="QHBoxLayout", **kwargs) + source_object = kwargs.get("source_object", None) + + self._field = QSpinBox(self._base) + self._field.setValue(1) + label = QLabel("Interpolation order", self._base) + self.numerator = QLabel("st order") + + self._field.valueChanged.connect(self.adjust_numerator) + + self._layout.addWidget(label) + self._layout.addWidget(self._field) + self._layout.addWidget(self.numerator) + self.default_labels() + self.update_labels() + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "The order of the polynomial function used for interpolating velocity values from atom positions. If zero, velocity values present in the trajectory will be used." + self._field.setToolTip(tooltip_text) + self.numerator.setToolTip(tooltip_text) + + def configure_using_default(self): + """This is too simple to have a default value""" + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "InterpolationOrderWidget" + if self._tooltip == "": + self._tooltip = "The order of the polynomial function used for interpolating velocity values from atom positions. If zero, velocity values present in the trajectory will be used." + + @Slot(int) + def adjust_numerator(self, order: int): + text_order = str(order) + new_numerator = suffix_dict.get(text_order[-1], " - no interpolation") + self.numerator.setText(new_numerator) + + def get_widget_value(self): + value = self._field.value() + + return value diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py index f9ca4e015f..3b689517f4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/InputWidgets/OutputDirectoryWidget.py -# @brief Implements module/class/test OutputDirectoryWidget +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QFileDialog diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py index 45e5e13c17..34a652a6fd 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py @@ -1,172 +1,176 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/OutputFilesWidget.py -# @brief Implements module/class/test OutputFilesWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import glob -import itertools -import os -import os.path - -from qtpy.QtWidgets import QComboBox, QLabel, QLineEdit, QPushButton, QFileDialog -from qtpy.QtCore import Qt, Slot -from qtpy.QtGui import QStandardItemModel, QStandardItem - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class CheckableComboBox(QComboBox): - def __init__(self, *args, **kwargs): - super(CheckableComboBox, self).__init__(*args, **kwargs) - self.view().pressed.connect(self.handleItemPressed) - self.setModel(QStandardItemModel(self)) - - def handleItemPressed(self, index): - item = self.model().itemFromIndex(index) - if item.checkState() == Qt.Checked: - item.setCheckState(Qt.Unchecked) - else: - item.setCheckState(Qt.Checked) - - def configure_using_default(self): - """This is too specific to have a default value""" - - def set_default(self, default: str): - model = self.model() - for row_number in range(model.rowCount()): - index = model.index(row_number, 0) - item = model.itemFromIndex(index) - text = model.data(index) - if text == default: - item.setCheckState(Qt.Checked) - else: - item.setCheckState(Qt.Unchecked) - - def checked_values(self): - result = [] - model = self.model() - for row_number in range(model.rowCount()): - index = model.index(row_number, 0) - item = model.itemFromIndex(index) - if item.checkState() == Qt.Checked: - text = model.data(index) - print(text) - result.append(text) - return result - - -class OutputFilesWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - default_value = self._configurator.default - try: - parent = kwargs.get("parent", None) - self.default_path = parent.default_path - except KeyError: - self.default_path = "." - print("KeyError in OutputFilesWidget - can't get default path.") - except AttributeError: - self.default_path = "." - print("AttributeError in OutputFilesWidget - can't get default path.") - self.file_association = ".*" - self._value = default_value - self._field = QLineEdit(default_value[0], self._base) - self._field.setPlaceholderText(default_value[0]) - self.type_box = CheckableComboBox(self._base) - self.type_box.addItems(self._configurator.formats) - self.type_box.set_default("MDAFormat") - # self.type_box.setCurrentText(default_value[1]) - browse_button = QPushButton("Browse", self._base) - browse_button.clicked.connect(self.file_dialog) - self._layout.addWidget(self._field) - self._layout.addWidget(self.type_box) - self._layout.addWidget(browse_button) - self._default_value = default_value - self._field.textChanged.connect(self.updateValue) - self.default_labels() - self.update_labels() - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "Analysis output will be saved under this name, and using the selected file types" - self._field.setToolTip(tooltip_text) - self.type_box.setToolTip(tooltip_text) - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "OutputFilesWidget" - if self._tooltip == "": - self._tooltip = "Analysis output will be saved under this name, and using the selected file types" - - @Slot() - def file_dialog(self): - """A Slot defined to allow the GUI to be updated based on - the new path received from a FileDialog. - This will start a FileDialog, take the resulting path, - and emit a signal to update the value show by the GUI. - """ - new_value = QFileDialog.getSaveFileName( - self._base, # the parent of the dialog - "Load a file", # the label of the window - self.default_path, # the initial search path - self.file_association, # text string specifying the file name filter. - ) - if len(new_value[0]) > 0: - self._field.setText(new_value[0]) - self.updateValue() - - @staticmethod - def _get_unique_filename(directory, basename): - filesInDirectory = [ - os.path.join(directory, e) - for e in itertools.chain( - glob.iglob(os.path.join(directory, "*")), - glob.iglob(os.path.join(directory, ".*")), - ) - if os.path.isfile(os.path.join(directory, e)) - ] - basenames = [os.path.splitext(f)[0] for f in filesInDirectory] - - initialPath = path = os.path.join(directory, basename) - comp = 1 - while True: - if path in basenames: - path = "%s(%d)" % (initialPath, comp) - comp += 1 - continue - return path - - def get_widget_value(self): - filename = self._field.text() - if len(filename) < 1: - filename = self._default_value[0] - - formats = self.type_box.checked_values() - - return (filename, formats) - - def set_data(self, datakey): - basename = "%s_%s" % ( - os.path.splitext(os.path.basename(datakey))[0], - self._parent.type, - ) - trajectoryDir = os.path.dirname(datakey) - - path = OutputFilesWidget._get_unique_filename(trajectoryDir, basename) - - self._filename.SetValue(path) +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import glob +import itertools +import os +import os.path + +from qtpy.QtWidgets import QComboBox, QLabel, QLineEdit, QPushButton, QFileDialog +from qtpy.QtCore import Qt, Slot +from qtpy.QtGui import QStandardItemModel, QStandardItem + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class CheckableComboBox(QComboBox): + def __init__(self, *args, **kwargs): + super(CheckableComboBox, self).__init__(*args, **kwargs) + self.view().pressed.connect(self.handleItemPressed) + self.setModel(QStandardItemModel(self)) + + def handleItemPressed(self, index): + item = self.model().itemFromIndex(index) + if item.checkState() == Qt.Checked: + item.setCheckState(Qt.Unchecked) + else: + item.setCheckState(Qt.Checked) + + def configure_using_default(self): + """This is too specific to have a default value""" + + def set_default(self, default: str): + model = self.model() + for row_number in range(model.rowCount()): + index = model.index(row_number, 0) + item = model.itemFromIndex(index) + text = model.data(index) + if text == default: + item.setCheckState(Qt.Checked) + else: + item.setCheckState(Qt.Unchecked) + + def checked_values(self): + result = [] + model = self.model() + for row_number in range(model.rowCount()): + index = model.index(row_number, 0) + item = model.itemFromIndex(index) + if item.checkState() == Qt.Checked: + text = model.data(index) + print(text) + result.append(text) + return result + + +class OutputFilesWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + default_value = self._configurator.default + try: + parent = kwargs.get("parent", None) + self.default_path = parent.default_path + except KeyError: + self.default_path = "." + print("KeyError in OutputFilesWidget - can't get default path.") + except AttributeError: + self.default_path = "." + print("AttributeError in OutputFilesWidget - can't get default path.") + self.file_association = ".*" + self._value = default_value + self._field = QLineEdit(default_value[0], self._base) + self._field.setPlaceholderText(default_value[0]) + self.type_box = CheckableComboBox(self._base) + self.type_box.addItems(self._configurator.formats) + self.type_box.set_default("MDAFormat") + # self.type_box.setCurrentText(default_value[1]) + browse_button = QPushButton("Browse", self._base) + browse_button.clicked.connect(self.file_dialog) + self._layout.addWidget(self._field) + self._layout.addWidget(self.type_box) + self._layout.addWidget(browse_button) + self._default_value = default_value + self._field.textChanged.connect(self.updateValue) + self.default_labels() + self.update_labels() + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "Analysis output will be saved under this name, and using the selected file types" + self._field.setToolTip(tooltip_text) + self.type_box.setToolTip(tooltip_text) + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "OutputFilesWidget" + if self._tooltip == "": + self._tooltip = "Analysis output will be saved under this name, and using the selected file types" + + @Slot() + def file_dialog(self): + """A Slot defined to allow the GUI to be updated based on + the new path received from a FileDialog. + This will start a FileDialog, take the resulting path, + and emit a signal to update the value show by the GUI. + """ + new_value = QFileDialog.getSaveFileName( + self._base, # the parent of the dialog + "Load a file", # the label of the window + self.default_path, # the initial search path + self.file_association, # text string specifying the file name filter. + ) + if len(new_value[0]) > 0: + self._field.setText(new_value[0]) + self.updateValue() + + @staticmethod + def _get_unique_filename(directory, basename): + filesInDirectory = [ + os.path.join(directory, e) + for e in itertools.chain( + glob.iglob(os.path.join(directory, "*")), + glob.iglob(os.path.join(directory, ".*")), + ) + if os.path.isfile(os.path.join(directory, e)) + ] + basenames = [os.path.splitext(f)[0] for f in filesInDirectory] + + initialPath = path = os.path.join(directory, basename) + comp = 1 + while True: + if path in basenames: + path = "%s(%d)" % (initialPath, comp) + comp += 1 + continue + return path + + def get_widget_value(self): + filename = self._field.text() + if len(filename) < 1: + filename = self._default_value[0] + + formats = self.type_box.checked_values() + + return (filename, formats) + + def set_data(self, datakey): + basename = "%s_%s" % ( + os.path.splitext(os.path.basename(datakey))[0], + self._parent.type, + ) + trajectoryDir = os.path.dirname(datakey) + + path = OutputFilesWidget._get_unique_filename(trajectoryDir, basename) + + self._filename.SetValue(path) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py index f2776ba78f..161fbee4a9 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/InputWidgets/OutputTrajectoryWidget.py -# @brief Implements module/class/test OutputTrajectoryWidget +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import itertools diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py index aae87850f7..37810306b8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py @@ -1,82 +1,86 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/ProjectionWidget.py -# @brief Implements module/class/test ProjectionWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QLineEdit, QRadioButton, QButtonGroup, QLabel, QHBoxLayout -from qtpy.QtCore import Slot, Signal - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class ProjectionWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - source_object = kwargs.get("source_object", None) - bgroup = QButtonGroup(self._base) - for id, blabel in enumerate(["None", "Axial", "Planar"]): - rbutton = QRadioButton(blabel, parent=self._base) - bgroup.addButton(rbutton, id=id) - self._layout.addWidget(rbutton) - if id == 0: - rbutton.setChecked(True) - self._changing_label = QLabel("N/A", parent=self._base) - self._layout.addWidget(self._changing_label) - vfields = [] - for _ in range(3): - temp = QLineEdit("0", self._base) - self._layout.addWidget(temp) - vfields.append(temp) - self._button_group = bgroup - self._vector_fields = vfields - self._mode = 0 - self._button_group.idClicked.connect(self.button_switched) - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "The spatial properties in the analysis can be projected on a plane or on an axis, as chosen here." - for wid in vfields: - wid.setToolTip(tooltip_text) - for wid in self._button_group.buttons(): - wid.setToolTip(tooltip_text) - - def configure_using_default(self): - """This is too complex to have a default value""" - - @Slot(int) - def button_switched(self, button_number: int): - button_id = self._button_group.checkedId() - if button_id == 0: - self._changing_label.setText("N/A") - for field in self._vector_fields: - field.setEnabled(False) - elif button_id == 1: - self._changing_label.setText("Axis direction") - for field in self._vector_fields: - field.setEnabled(True) - else: - self._changing_label.setText("Plane normal") - for field in self._vector_fields: - field.setEnabled(True) - self._mode = button_id - - def get_widget_value(self): - """Collect the results from the input widgets and return the value.""" - if self._mode == 0: - return ("NullProjector", []) - vector = [float(x.text()) for x in self._vector_fields] - if self._mode == 1: - return ("AxialProjector", vector) - else: - return ("PlanarProjector", vector) +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QLineEdit, QRadioButton, QButtonGroup, QLabel, QHBoxLayout +from qtpy.QtCore import Slot, Signal + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class ProjectionWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + source_object = kwargs.get("source_object", None) + bgroup = QButtonGroup(self._base) + for id, blabel in enumerate(["None", "Axial", "Planar"]): + rbutton = QRadioButton(blabel, parent=self._base) + bgroup.addButton(rbutton, id=id) + self._layout.addWidget(rbutton) + if id == 0: + rbutton.setChecked(True) + self._changing_label = QLabel("N/A", parent=self._base) + self._layout.addWidget(self._changing_label) + vfields = [] + for _ in range(3): + temp = QLineEdit("0", self._base) + self._layout.addWidget(temp) + vfields.append(temp) + self._button_group = bgroup + self._vector_fields = vfields + self._mode = 0 + self._button_group.idClicked.connect(self.button_switched) + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "The spatial properties in the analysis can be projected on a plane or on an axis, as chosen here." + for wid in vfields: + wid.setToolTip(tooltip_text) + for wid in self._button_group.buttons(): + wid.setToolTip(tooltip_text) + + def configure_using_default(self): + """This is too complex to have a default value""" + + @Slot(int) + def button_switched(self, button_number: int): + button_id = self._button_group.checkedId() + if button_id == 0: + self._changing_label.setText("N/A") + for field in self._vector_fields: + field.setEnabled(False) + elif button_id == 1: + self._changing_label.setText("Axis direction") + for field in self._vector_fields: + field.setEnabled(True) + else: + self._changing_label.setText("Plane normal") + for field in self._vector_fields: + field.setEnabled(True) + self._mode = button_id + + def get_widget_value(self): + """Collect the results from the input widgets and return the value.""" + if self._mode == 0: + return ("NullProjector", []) + vector = [float(x.text()) for x in self._vector_fields] + if self._mode == 1: + return ("AxialProjector", vector) + else: + return ("PlanarProjector", vector) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py index 6a1a2b82bf..09f9bb51af 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py @@ -1,121 +1,125 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/HDFTrajectoryWidget.py -# @brief Implements module/class/test HDFTrajectoryWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QLineEdit, QComboBox, QLabel, QTableView -from qtpy.QtCore import Slot, Signal, Qt -from qtpy.QtGui import QIntValidator, QStandardItemModel, QStandardItem, QBrush - -from MDANSE.Framework.QVectors.IQVectors import IQVectors - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class VectorModel(QStandardItemModel): - def __init__(self, *args, chemical_system=None, **kwargs): - super().__init__(*args, **kwargs) - self._generator = None - self._defaults = [] - self._chemical_system = chemical_system - - @Slot(str) - def switch_qvector_type(self, vector_type: str): - self.clear() - self._defaults = [] - self._generator = IQVectors.create(vector_type, self._chemical_system) - settings = self._generator.settings - for kv in settings.items(): - name = kv[0] # dictionary key - value = kv[1][1]["default"] # tuple value 1: dictionary - self._defaults.append(value) - vtype = kv[1][0] # tuple value 0: type - items = [QStandardItem(str(x)) for x in [name, value, vtype]] - for it in items[0::2]: - it.setEditable(False) - for it in items[1::2]: - it.setData(value, role=Qt.ItemDataRole.ToolTipRole) - self.appendRow(items) - - def params_summary(self) -> dict: - params = {} - for rownum in range(self.rowCount()): - name = str(self.item(rownum, 0).text()) - value = str(self.item(rownum, 1).text()) - vtype = str(self.item(rownum, 2).text()) - try: - params[name] = self.parse_vtype(vtype, value, name) - except ValueError: - params[name] = self._defaults[rownum] - self.item(rownum, 1).setData( - QBrush(Qt.GlobalColor.red), role=Qt.ItemDataRole.BackgroundRole - ) - else: - self.item(rownum, 1).setData( - QBrush(Qt.GlobalColor.white), role=Qt.ItemDataRole.BackgroundRole - ) - return params - - def parse_vtype(self, vtype: str, value: str, vname: str): - if vtype == "RangeConfigurator": - inner_type = self._generator.settings[vname][1]["valueType"] - tempstring = value.strip("()[] ") - return [inner_type(x) for x in tempstring.split(",")] - elif vtype == "VectorConfigurator": - inner_type = self._generator.settings[vname][1]["valueType"] - tempstring = value.strip("()[] ") - return [inner_type(x) for x in tempstring.split(",")] - elif vtype == "FloatConfigurator": - return float(value) - elif vtype == "IntegerConfigurator": - return int(value) - else: - return value - - -class QVectorsWidget(WidgetBase): - def __init__(self, *args, **kwargs): - kwargs["layout_type"] = "QVBoxLayout" - super().__init__(*args, **kwargs) - trajectory_configurator = kwargs.get("trajectory_configurator", None) - chemical_system = None - if trajectory_configurator is not None: - chemical_system = trajectory_configurator["instance"].chemical_system - self._selector = QComboBox(self._base) - self._selector.addItems(IQVectors.indirect_subclasses()) - self._model = VectorModel(self._base, chemical_system=chemical_system) - self._view = QTableView(self._base) - self._layout.addWidget(self._selector) - self._layout.addWidget(self._view) - self._view.setModel(self._model) - self._selector.currentTextChanged.connect(self._model.switch_qvector_type) - self._selector.setCurrentIndex(1) - self._model.itemChanged.connect(self.updateValue) - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "The parameters needed by the specific q-vector generator can be input here" - self._view.setToolTip(tooltip_text) - self._selector.setToolTip( - "The q vectors will be generated using the method chosen here." - ) - - def get_widget_value(self): - """Collect the results from the input widgets and return the value.""" - qvector_type = self._selector.currentText() - pardict = self._model.params_summary() - return (qvector_type, pardict) - - def configure_using_default(self): - """This is too complex to have a default value""" +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QLineEdit, QComboBox, QLabel, QTableView +from qtpy.QtCore import Slot, Signal, Qt +from qtpy.QtGui import QIntValidator, QStandardItemModel, QStandardItem, QBrush + +from MDANSE.Framework.QVectors.IQVectors import IQVectors + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class VectorModel(QStandardItemModel): + def __init__(self, *args, chemical_system=None, **kwargs): + super().__init__(*args, **kwargs) + self._generator = None + self._defaults = [] + self._chemical_system = chemical_system + + @Slot(str) + def switch_qvector_type(self, vector_type: str): + self.clear() + self._defaults = [] + self._generator = IQVectors.create(vector_type, self._chemical_system) + settings = self._generator.settings + for kv in settings.items(): + name = kv[0] # dictionary key + value = kv[1][1]["default"] # tuple value 1: dictionary + self._defaults.append(value) + vtype = kv[1][0] # tuple value 0: type + items = [QStandardItem(str(x)) for x in [name, value, vtype]] + for it in items[0::2]: + it.setEditable(False) + for it in items[1::2]: + it.setData(value, role=Qt.ItemDataRole.ToolTipRole) + self.appendRow(items) + + def params_summary(self) -> dict: + params = {} + for rownum in range(self.rowCount()): + name = str(self.item(rownum, 0).text()) + value = str(self.item(rownum, 1).text()) + vtype = str(self.item(rownum, 2).text()) + try: + params[name] = self.parse_vtype(vtype, value, name) + except ValueError: + params[name] = self._defaults[rownum] + self.item(rownum, 1).setData( + QBrush(Qt.GlobalColor.red), role=Qt.ItemDataRole.BackgroundRole + ) + else: + self.item(rownum, 1).setData( + QBrush(Qt.GlobalColor.white), role=Qt.ItemDataRole.BackgroundRole + ) + return params + + def parse_vtype(self, vtype: str, value: str, vname: str): + if vtype == "RangeConfigurator": + inner_type = self._generator.settings[vname][1]["valueType"] + tempstring = value.strip("()[] ") + return [inner_type(x) for x in tempstring.split(",")] + elif vtype == "VectorConfigurator": + inner_type = self._generator.settings[vname][1]["valueType"] + tempstring = value.strip("()[] ") + return [inner_type(x) for x in tempstring.split(",")] + elif vtype == "FloatConfigurator": + return float(value) + elif vtype == "IntegerConfigurator": + return int(value) + else: + return value + + +class QVectorsWidget(WidgetBase): + def __init__(self, *args, **kwargs): + kwargs["layout_type"] = "QVBoxLayout" + super().__init__(*args, **kwargs) + trajectory_configurator = kwargs.get("trajectory_configurator", None) + chemical_system = None + if trajectory_configurator is not None: + chemical_system = trajectory_configurator["instance"].chemical_system + self._selector = QComboBox(self._base) + self._selector.addItems(IQVectors.indirect_subclasses()) + self._model = VectorModel(self._base, chemical_system=chemical_system) + self._view = QTableView(self._base) + self._layout.addWidget(self._selector) + self._layout.addWidget(self._view) + self._view.setModel(self._model) + self._selector.currentTextChanged.connect(self._model.switch_qvector_type) + self._selector.setCurrentIndex(1) + self._model.itemChanged.connect(self.updateValue) + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "The parameters needed by the specific q-vector generator can be input here" + self._view.setToolTip(tooltip_text) + self._selector.setToolTip( + "The q vectors will be generated using the method chosen here." + ) + + def get_widget_value(self): + """Collect the results from the input widgets and return the value.""" + qvector_type = self._selector.currentText() + pardict = self._model.params_summary() + return (qvector_type, pardict) + + def configure_using_default(self): + """This is too complex to have a default value""" diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py index 2f654279cf..b24032405d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/InputWidgets/FramesWidget.py -# @brief Implements module/class/test FramesWidget +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py index fa770cbd36..6a3de5bc6c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py @@ -1,82 +1,86 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/RunningModeWidget.py -# @brief Implements module/class/test RunningModeWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -import multiprocessing - -from qtpy.QtWidgets import QComboBox, QSpinBox -from qtpy.QtCore import Qt, Slot - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class RunningModeWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self._totalNumberOfProcessors = multiprocessing.cpu_count() - self._last_numproc = None - default_value = self._configurator.default - self._value = default_value - self.mode_box = QComboBox(self._base) - self.mode_box.addItems(self._configurator.availablesModes) - self.mode_box.setCurrentText(self._configurator.availablesModes[0]) - self._field = QSpinBox(self._base) - self._field.setValue(1) - self._field.setMinimum(1) - self._layout.addWidget(self.mode_box) - self._layout.addWidget(self._field) - self.mode_box.currentIndexChanged.connect(self.mode_changed) - self._field.valueChanged.connect(self.numproc_changed) - self.update_labels() - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "Choose if the job should run on one or more cores." - for wid in [self._field, self.mode_box]: - wid.setToolTip(tooltip_text) - - def configure_using_default(self): - """This is too complex to have a default value""" - - @Slot() - def mode_changed(self): - mode = self.mode_box.currentText() - if self._last_numproc is None: - nextval = self._totalNumberOfProcessors - else: - nextval = self._last_numproc - if mode == "single-core": - self._field.setValue(1) - self._field.setEnabled(False) - else: - self._field.setEnabled(True) - self._field.setValue(nextval) - - @Slot() - def numproc_changed(self): - mode = self.mode_box.currentText() - numproc = self._field.value() - if mode == "single-core": - return - self._last_numproc = numproc - - def get_widget_value(self): - mode = self.mode_box.currentText() - numproc = self._field.value() - if mode == "single-core": - value = (mode,) - else: - value = (mode, numproc) - return value +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +import multiprocessing + +from qtpy.QtWidgets import QComboBox, QSpinBox +from qtpy.QtCore import Qt, Slot + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class RunningModeWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._totalNumberOfProcessors = multiprocessing.cpu_count() + self._last_numproc = None + default_value = self._configurator.default + self._value = default_value + self.mode_box = QComboBox(self._base) + self.mode_box.addItems(self._configurator.availablesModes) + self.mode_box.setCurrentText(self._configurator.availablesModes[0]) + self._field = QSpinBox(self._base) + self._field.setValue(1) + self._field.setMinimum(1) + self._layout.addWidget(self.mode_box) + self._layout.addWidget(self._field) + self.mode_box.currentIndexChanged.connect(self.mode_changed) + self._field.valueChanged.connect(self.numproc_changed) + self.update_labels() + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "Choose if the job should run on one or more cores." + for wid in [self._field, self.mode_box]: + wid.setToolTip(tooltip_text) + + def configure_using_default(self): + """This is too complex to have a default value""" + + @Slot() + def mode_changed(self): + mode = self.mode_box.currentText() + if self._last_numproc is None: + nextval = self._totalNumberOfProcessors + else: + nextval = self._last_numproc + if mode == "single-core": + self._field.setValue(1) + self._field.setEnabled(False) + else: + self._field.setEnabled(True) + self._field.setValue(nextval) + + @Slot() + def numproc_changed(self): + mode = self.mode_box.currentText() + numproc = self._field.value() + if mode == "single-core": + return + self._last_numproc = numproc + + def get_widget_value(self): + mode = self.mode_box.currentText() + numproc = self._field.value() + if mode == "single-core": + value = (mode,) + else: + value = (mode, numproc) + return value diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py index e8cb4241b4..6453b4b2a5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py @@ -1,66 +1,70 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Src/PyQtGUI/InputWidgets/StringWidget.py -# @brief Implements module/class/test StringWidget -# -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** - -from qtpy.QtWidgets import QLineEdit -from qtpy.QtCore import Slot - -from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase - - -class StringWidget(WidgetBase): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - default_option = self._configurator.default - field = QLineEdit(self._base) - field.setText(default_option) - field.setPlaceholderText(default_option) - field.textChanged.connect(self.updateValue) - field.setToolTip(self._tooltip) - self._field = field - self._default_value = default_option - self._layout.addWidget(field) - self.default_labels() - self.update_labels() - self.updateValue() - if self._tooltip: - tooltip_text = self._tooltip - else: - tooltip_text = "A text string variable. When in doubt, erase the text to see the example (placeholder) text" - field.setToolTip(tooltip_text) - - def default_labels(self): - """Each Widget should have a default tooltip and label, - which will be set in this method, unless specific - values are provided in the settings of the job that - is being configured.""" - if self._label_text == "": - self._label_text = "StringWidget" - if self._tooltip == "": - self._tooltip = "A text string variable. When in doubt, erase the text to see the example (placeholder) text" - - def get_widget_value(self): - """Collect the results from the input widgets and return the value.""" - strval = self._field.text().strip() - if len(strval) < 1: - self._empty = True - return self._default_value - else: - self._empty = False - return strval - - def configure_using_default(self): - default = self._configurator.default - self._field.setPlaceholderText(default) - self._configurator.configure(default) +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) + +from qtpy.QtWidgets import QLineEdit +from qtpy.QtCore import Slot + +from MDANSE_GUI.InputWidgets.WidgetBase import WidgetBase + + +class StringWidget(WidgetBase): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + default_option = self._configurator.default + field = QLineEdit(self._base) + field.setText(default_option) + field.setPlaceholderText(default_option) + field.textChanged.connect(self.updateValue) + field.setToolTip(self._tooltip) + self._field = field + self._default_value = default_option + self._layout.addWidget(field) + self.default_labels() + self.update_labels() + self.updateValue() + if self._tooltip: + tooltip_text = self._tooltip + else: + tooltip_text = "A text string variable. When in doubt, erase the text to see the example (placeholder) text" + field.setToolTip(tooltip_text) + + def default_labels(self): + """Each Widget should have a default tooltip and label, + which will be set in this method, unless specific + values are provided in the settings of the job that + is being configured.""" + if self._label_text == "": + self._label_text = "StringWidget" + if self._tooltip == "": + self._tooltip = "A text string variable. When in doubt, erase the text to see the example (placeholder) text" + + def get_widget_value(self): + """Collect the results from the input widgets and return the value.""" + strval = self._field.text().strip() + if len(strval) < 1: + self._empty = True + return self._default_value + else: + self._empty = False + return strval + + def configure_using_default(self): + default = self._configurator.default + self._field.setPlaceholderText(default) + self._configurator.configure(default) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py index f9cc85aaac..3f4df5f125 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/InputWidgets/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from abc import abstractmethod diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py index efa113e069..78668ec938 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/InputWidgets/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/AtomProperties.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/AtomProperties.py index e5cd38e45b..d3a0c586b8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/AtomProperties.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/AtomProperties.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief molecular viewer code from the "waterstay" project +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from typing import List diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/ColourManager.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/ColourManager.py index 0e6f0e6cc4..fab3fc250c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/ColourManager.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/ColourManager.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief extension of the waterstay code +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Maciej Bartkowiak +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Maciej Bartkowiak import numpy as np import vtk diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Contents.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Contents.py index 88c9af7e57..68936488d2 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Contents.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Contents.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief extension of the waterstay code +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Maciej Bartkowiak +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Maciej Bartkowiak import numpy as np from qtpy.QtGui import QStandardItemModel, QStandardItem diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Controls.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Controls.py index 088266e9da..c3027ea8d5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Controls.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Controls.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief molecular viewer code from the "waterstay" project +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy.QtCore import Signal, Slot, Qt, QTimer, QMutex from qtpy.QtWidgets import ( diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Dummy.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Dummy.py index f17d475d73..06a9f32992 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Dummy.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Dummy.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief extension of the waterstay code +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Maciej Bartkowiak +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Maciej Bartkowiak import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py index efc806b78f..1880bde729 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief molecular viewer code from the "waterstay" project +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import logging from typing import List diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/__init__.py index 104ab0903e..d855a31764 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/__init__.py @@ -1,13 +1,17 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief molecular viewer code from the "waterstay" project +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/database/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/database/__init__.py index 5caf2810c7..0306ae5b85 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/database/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/database/__init__.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief molecular viewer code from the "waterstay" project +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import os import yaml diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/__init__.py index 5b3b8d9600..b278bb6d0c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/__init__.py @@ -1,8 +1,21 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# import glob import os -# from .reader_registry import REGISTERED_READERS - def path_to_module(path, stop=""): path, _ = os.path.splitext(path) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/hdf5wrapper.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/hdf5wrapper.py index ed50ed49a8..958b6cb06c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/hdf5wrapper.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/hdf5wrapper.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief extension of the waterstay code +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Maciej Bartkowiak +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Maciej Bartkowiak import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/i_reader.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/i_reader.py index 63a5bc555d..4155379730 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/i_reader.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/i_reader.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief molecular viewer code from the "waterstay" project +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import abc import collections diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/reader_registry.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/reader_registry.py index 774df79888..b1f3f5c904 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/reader_registry.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/reader_registry.py @@ -1,18 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief molecular viewer code from the "waterstay" project +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini -# This dict will store a map between a filename extension and the actual reader corresponding to that file extension REGISTERED_READERS = {} diff --git a/MDANSE_GUI/Src/MDANSE_GUI/PeriodicTableViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/PeriodicTableViewer.py index 138903991b..f300c848c7 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/PeriodicTableViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/PeriodicTableViewer.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/PeriodicTableViewer.py -# @brief Shows the periodic table of elements. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtWidgets import ( QDialog, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py index 3f089573ed..d855a31764 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py @@ -1,13 +1,17 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py index 2d16a3a5ea..2f4dd407d1 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import platform diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/cross_viewer_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/cross_viewer_dialog.py index 67c8361a0b..1ccb77c4d6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/cross_viewer_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/cross_viewer_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtGui, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_1d_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_1d_dialog.py index 6e95fa5a14..e0121407d0 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_1d_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_1d_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtGui, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_nd_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_nd_dialog.py index 2c852b80fd..e0e8a3da08 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_nd_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_nd_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtGui, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/inspect_data_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/inspect_data_dialog.py index 3d4de9fc3b..76f595a05d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/inspect_data_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/inspect_data_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_axis_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_axis_settings_dialog.py index 07696958b5..61187b11ba 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_axis_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_axis_settings_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_general_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_general_settings_dialog.py index 5647ffaa1b..437a1ee14b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_general_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_general_settings_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_lines_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_lines_settings_dialog.py index 9ae1e01a14..2cb6d81abb 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_lines_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_lines_settings_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_general_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_general_settings_dialog.py index 829c045e77..6c92322c22 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_general_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_general_settings_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_image_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_image_settings_dialog.py index 78b8b28276..1b8f11a2be 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_image_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_image_settings_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_axis_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_axis_settings_dialog.py index 693b1dc8e9..3eedd740fb 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_axis_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_axis_settings_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_general_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_general_settings_dialog.py index 6f810d093c..f0d1df47b3 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_general_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_general_settings_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_image_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_image_settings_dialog.py index 188436f3ec..bb371d302d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_image_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_image_settings_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/slice_viewer_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/slice_viewer_dialog.py index 0a94b517e5..8ccc2b07f8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/slice_viewer_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/slice_viewer_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/units_editor_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/units_editor_dialog.py index badf9ecdac..1a559879d6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/units_editor_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/units_editor_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import copy diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/viewer_1d_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/viewer_1d_dialog.py index f6653e6032..bc17b79b9c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/viewer_1d_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/viewer_1d_dialog.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_popup.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_popup.py index f6cfa2f2ad..cb8aaf583f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_popup.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_popup.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import logging diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_widget.py index ca3d571123..d0fad1ad13 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import logging diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_list_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_list_model.py index c8e5a498fe..22ba159e2a 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_list_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_list_model.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_tree_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_tree_model.py index 47db2a417c..3a09690af9 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_tree_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_tree_model.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import abc import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py index ba9cbdbec6..876a4d047d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_2d_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_2d_model.py index 03aee2ecf7..cb8ea92898 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_2d_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_2d_model.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_nd_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_nd_model.py index 8e758d4d18..c1e7e75a2a 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_nd_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_nd_model.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/numeric.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/numeric.py index 4c6b28f56e..7db49794b5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/numeric.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/numeric.py @@ -1,20 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini -#!/usr/bin/python - -# Code taken from https://github.com/valdezt/sigfig import copy import decimal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_dict.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_dict.py index 3b94736d7f..290048cfc4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_dict.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_dict.py @@ -1,18 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini -# code taken from https://github.com/grantjenks/python-sortedcontainers """Sorted Dict ============== diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_list.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_list.py index 5d414fe479..01d235ed46 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_list.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_list.py @@ -1,18 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini -# code taken from https://github.com/grantjenks/python-sortedcontainers """Sorted List ============== diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_set.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_set.py index b2b88ec6e4..a718db6b9b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_set.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_set.py @@ -1,18 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini -# code taken from https://github.com/grantjenks/python-sortedcontainers """Sorted Set ============= diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/table_views.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/table_views.py index 20a4563112..14fb82eeb8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/table_views.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/table_views.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/actions_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/actions_widget.py index bf3d18d416..dffb9e5bb7 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/actions_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/actions_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/data_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/data_widget.py index 9e4ebf744a..94f13d9aaf 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/data_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/data_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/datasets_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/datasets_widget.py index 85a146294b..9b7379fb8f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/datasets_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/datasets_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/logger_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/logger_widget.py index 5528e2dd1e..87a8523ee6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/logger_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/logger_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import logging diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/main_window.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/main_window.py index 2c38356c6c..371d6fbc32 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/main_window.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/main_window.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import logging import sys diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_1d_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_1d_widget.py index 0ee6edf3a5..9447cb8527 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_1d_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_1d_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_2d_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_2d_widget.py index 9d609268b1..8635557429 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_2d_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_2d_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_actions_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_actions_widget.py index dfa6d22525..ebd3289b7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_actions_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_actions_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_nd_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_nd_widget.py index 5180c015d3..b2eae23126 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_nd_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_nd_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/preview_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/preview_widget.py index 95bbc3f6cb..066b0cf67b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/preview_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/preview_widget.py @@ -1,16 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini from pylab import Figure from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/range_slider.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/range_slider.py index 38554cfc06..6e20d9743b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/range_slider.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/range_slider.py @@ -1,18 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Plotter/__init__.py -# @brief root file of Plotter +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2023-now -# @authors Eric Pellegrini +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2023-now +# Authors: Eric Pellegrini -# Code taken from https://stackoverflow.com/questions/67028200/pyqt5-qslider-two-positions from qtpy import QtCore, QtGui, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py index 40434acf8e..1f4423d5cc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/RegistryViewer.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) """This module contains a RegistryTree data model, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Resources.py b/MDANSE_GUI/Src/MDANSE_GUI/Resources.py index 741608cdb7..954d745028 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Resources.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Resources.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Resources.py -# @brief Access to external files (icons, etc.) +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtCore import QDir, QSize from qtpy.QtGui import QIcon, QPixmap diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py index 70a400d7d1..9d83217845 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py index 5544de81ee..c17dfd3197 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import sys diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py index 0e9d1cdfe4..b093a0fcac 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py index bf14cc439a..1c53d58c04 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py index 4001b117d9..0ea7913e94 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Session/LocalSession.py b/MDANSE_GUI/Src/MDANSE_GUI/Session/LocalSession.py index fe82cd406c..7bbb4b8f9a 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Session/LocalSession.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Session/LocalSession.py @@ -1,3 +1,19 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + import os from qtpy.QtCore import QObject, Signal, Slot @@ -25,7 +41,6 @@ def __init__(self, *args, **kwargs): def populate_defaults(self): self._paths["root_directory"] = os.path.expanduser("~") - # self._units["energy"] = "meV" self._units["time"] = "fs" self._units["distance"] = "Ang" diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Session/Logger.py b/MDANSE_GUI/Src/MDANSE_GUI/Session/Logger.py index ba097077b6..10259017e3 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Session/Logger.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Session/Logger.py @@ -1,3 +1,19 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + import logging import time diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py index e69de29bb2..f5b12a98f1 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py @@ -0,0 +1,16 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + diff --git a/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py index 922456338c..a10919405f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/RegistryViewer.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) """This module contains a RegistryTree data model, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobState.py b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobState.py index bb1d10bfb0..9a220476c0 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobState.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobState.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from abc import ABC, abstractmethod diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobStatusProcess.py b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobStatusProcess.py index dd522d24e2..e2872bb9ed 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobStatusProcess.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobStatusProcess.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/DataViewModel/JobHolder.py -# @brief Subclass of QStandardItemModel for MDANSE jobs +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Tuple from multiprocessing import Pipe, Queue, Process, Event diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py index e6fc7e36bd..c4844f8575 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/DataViewModel/JobHolder.py -# @brief Subclass of QStandardItemModel for MDANSE jobs +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from multiprocessing import Pipe, Queue, Process, Event from multiprocessing.connection import Connection diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py b/MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py index f5750acb37..3ceab27644 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE_GUI/TabbedWindow.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) import os from collections import defaultdict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py index 218c09c49f..cdb54c164d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE_GUI/Tabs/ConverterTab.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from functools import partial from qtpy.QtCore import Slot from qtpy.QtWidgets import QWidget diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py index deef710bae..25127cf61d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py @@ -1,20 +1,23 @@ -from qtpy.QtCore import QObject, Slot, Signal - - -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/RegistryViewer.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) +from qtpy.QtCore import QObject, Slot, Signal + import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py index 77d22b6e07..a1d238fa79 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE_GUI/Tabs/JobTab.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from functools import partial from qtpy.QtCore import Slot from qtpy.QtWidgets import QWidget, QComboBox diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/DoublePanel.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/DoublePanel.py index d2e771d2a0..3dac7036ca 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/DoublePanel.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/DoublePanel.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE_GUI/Tabs/Layouts/DoublePanel.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtWidgets import ( QWidget, QHBoxLayout, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/SinglePanel.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/SinglePanel.py index dedd1062dc..6ce50e0e87 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/SinglePanel.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/SinglePanel.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/MainWindow.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/TriplePanel.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/TriplePanel.py index fb547c63c2..7c2b77ce55 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/TriplePanel.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/TriplePanel.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE_GUI/Tabs/Layouts/TriplePanel.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from .DoublePanel import DoublePanel diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py index 40340bf3ca..aef1a3c106 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/RegistryViewer.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtCore import QObject, Slot, Signal, QMessageLogger, qInstallMessageHandler diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/GeneralModel.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/GeneralModel.py index 032cab05a0..fd51d102be 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/GeneralModel.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/GeneralModel.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from qtpy.QtCore import QObject, Slot, Signal, QMutex, QModelIndex from qtpy.QtGui import QStandardItemModel, QStandardItem diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py index 54f7f62b27..19c149c3d9 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/DataViewModel/JobHolder.py -# @brief Subclass of QStandardItemModel for MDANSE jobs +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from multiprocessing import Pipe, Queue, Event diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobTree.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobTree.py index 51ca358390..c46660dcfa 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobTree.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobTree.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from MDANSE.Framework.Jobs.IJob import IJob from qtpy.QtGui import QStandardItemModel, QStandardItem diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py index c84bf95345..dff1428cb3 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/RegistryViewer.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtCore import QObject, Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Settings/LocalSettings.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Settings/LocalSettings.py index 73ae1daca3..599384b11c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Settings/LocalSettings.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Settings/LocalSettings.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# class LocalSettings: def __init__(self, *args, **kwargs): self._settings = {} diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Settings/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Settings/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Settings/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Settings/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py index caea47f689..1fa7d3226e 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/RegistryViewer.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import os from functools import partial diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/ActionsTree.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/ActionsTree.py index 3f35698f58..98e2f94bee 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/ActionsTree.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/ActionsTree.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE_GUI/Tabs/Views/ActionsTree.py -# @brief Here we can generate some Widgets +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union from icecream import ic diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py index f351109596..c5ef024e59 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/RegistryViewer.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from PyQt6.QtCore import QAbstractItemModel, QObject from qtpy.QtCore import Slot, Signal, QModelIndex, Qt diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py index 9142f992e3..520bb3bf4f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/RegistryViewer.py -# @brief Shows the MDANSE jobs. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) from typing import Union from qtpy.QtCore import Slot, Signal, QModelIndex diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/Action.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/Action.py index 2b3e924aad..e6ce9997e9 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/Action.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/Action.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file MDANSE_GUI/Tabs/Visualisers/Action.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************* +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Optional from qtpy.QtWidgets import ( QPushButton, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/AnalysisInfo.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/AnalysisInfo.py index f40ad5b701..484e7d585f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/AnalysisInfo.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/AnalysisInfo.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from collections import defaultdict from qtpy.QtCore import QObject, Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/TextInfo.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/TextInfo.py index 639bee7b6b..c384563b01 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/TextInfo.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/TextInfo.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from qtpy.QtCore import QObject, Slot, Signal from qtpy.QtWidgets import QPushButton, QTextBrowser, QWidget, QFileDialog diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/TrajectoryInfo.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/TrajectoryInfo.py index e104ad9372..199b2cf6cc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/TrajectoryInfo.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/TrajectoryInfo.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from collections import defaultdict from qtpy.QtCore import QObject, Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/View3D.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/View3D.py index 139c6d00b3..8417341e98 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/View3D.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/View3D.py @@ -1,3 +1,18 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# from qtpy.QtWidgets import QWidget, QVBoxLayout from qtpy.QtCore import Slot, Signal @@ -25,7 +40,6 @@ def __init__(self, *args, **kwargs): def update_panel(self, data: tuple): fullpath, incoming = data if fullpath == "" or data is None: - # a trajectory was deleted we need to clear the panel self._viewer.clear_panel() return diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/__init__.py index e69de29bb2..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/__init__.py @@ -0,0 +1,15 @@ +# This file is part of MDANSE_GUI. +# +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# diff --git a/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py b/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py index 9ea437ff3d..98201aff37 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/UnitsEditor.py -# @brief Shows the physical unit editor. Can run standalone. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import copy diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertDialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertDialog.py index 9480607d72..72b461a031 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertDialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertDialog.py @@ -1,17 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/MainWindow.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertWizard.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertWizard.py index e3e839c601..438a64f6ed 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertWizard.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertWizard.py @@ -1,17 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/MainWindow.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/GeneralWidgets.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/GeneralWidgets.py index 597955f7fa..8f05f079a2 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/GeneralWidgets.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/GeneralWidgets.py @@ -1,17 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/MainWindow.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Generator.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Generator.py index 65336270c0..4655eeb90b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Generator.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Generator.py @@ -1,17 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Widgets/Generator.py -# @brief Here we can generate some Widgets +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtWidgets import QWidget, QDockWidget, QScrollArea diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/LoaderButton.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/LoaderButton.py index 0c9d6e3840..f4e2a46015 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/LoaderButton.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/LoaderButton.py @@ -1,17 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/MainWindow.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from icecream import ic diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Oscillator.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Oscillator.py index c70162c5e4..f2e5d8d5f0 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Oscillator.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Oscillator.py @@ -1,17 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Widgets/Oscillator.py -# @brief A progress bar that goes there and back +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtCore import Slot, Signal, QObject, QTimer from qtpy.QtWidgets import QProgressBar diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/StyleDialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/StyleDialog.py index 33c6168762..2eccdf82dc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/StyleDialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/StyleDialog.py @@ -1,17 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/MainWindow.py -# @brief Base widget for the MDANSE GUI +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable, Optional from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/TrajectoryViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/TrajectoryViewer.py index f373c27c4f..b5a5d30f8a 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/TrajectoryViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/TrajectoryViewer.py @@ -1,17 +1,20 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Widgets/Generator.py -# @brief Here we can generate some Widgets +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) import typing diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py index de4a7f3001..6466823cb0 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py @@ -1,14 +1,17 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/Widgets/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py index c200a00d63..6efe5c550e 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__init__.py -# @brief Implements module/class/test __init__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import warnings diff --git a/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py b/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py index b33df18ade..2d6f7c2fa7 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/__pkginfo__.py -# @brief Implements module/class/test __pkginfo__ +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) __description__ = "Graphical User Interface for the MDANSE software" diff --git a/MDANSE_GUI/Src/MDANSE_GUI/main.py b/MDANSE_GUI/Src/MDANSE_GUI/main.py index e201d249ee..6c29cb92e3 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/main.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/main.py @@ -1,17 +1,21 @@ -# ************************************************************************** +# This file is part of MDANSE_GUI. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE_GUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Src/PyQtGUI/main.py -# @brief Starts the QApplication instance +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Research Software Group at ISIS (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Research Software Group at ISIS (see AUTHORS) import sys import os import time From 20d7bed72f44a825ab4cad59072bffa1cb548f23 Mon Sep 17 00:00:00 2001 From: Maciej Bartkowiak Date: Wed, 27 Mar 2024 12:05:52 +0000 Subject: [PATCH 03/11] Replace file headers of Extensions with GPL-compliant headers --- MDANSE/Extensions/atomic_trajectory.pyx | 25 +++++---- MDANSE/Extensions/atoms_in_shell.pyx | 25 +++++---- MDANSE/Extensions/change_coordinates.pyx | 25 +++++---- MDANSE/Extensions/com_trajectory.pyx | 25 +++++---- MDANSE/Extensions/contiguous_coordinates.pyx | 25 +++++---- MDANSE/Extensions/distance_histogram.pyx | 25 +++++---- MDANSE/Extensions/fast_calculation.pyx | 25 +++++---- MDANSE/Extensions/fold_coordinates.pyx | 25 +++++---- MDANSE/Extensions/mic_fast_calc.pyx | 25 +++++---- MDANSE/Extensions/mt_fast_calc.pyx | 25 +++++---- MDANSE/Extensions/qhull.pyx | 31 +++++------ MDANSE/Extensions/sas_fast_calc.pyx | 25 +++++---- MDANSE/Extensions/sd_fast_calc.pyx | 25 +++++---- MDANSE/Extensions/xtc/trr.pyx | 54 +++++++------------- MDANSE/Extensions/xtc/xtc.pyx | 53 +++++++------------ 15 files changed, 233 insertions(+), 205 deletions(-) diff --git a/MDANSE/Extensions/atomic_trajectory.pyx b/MDANSE/Extensions/atomic_trajectory.pyx index 1db74a75ea..53fa1b2882 100644 --- a/MDANSE/Extensions/atomic_trajectory.pyx +++ b/MDANSE/Extensions/atomic_trajectory.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/distance_histogram.pyx -# @brief Implements module/class/test distance_histogram +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/atoms_in_shell.pyx b/MDANSE/Extensions/atoms_in_shell.pyx index c40790f051..193b9853a4 100644 --- a/MDANSE/Extensions/atoms_in_shell.pyx +++ b/MDANSE/Extensions/atoms_in_shell.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/distance_histogram.pyx -# @brief Implements module/class/test distance_histogram +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/change_coordinates.pyx b/MDANSE/Extensions/change_coordinates.pyx index 03b4136a8c..3691f537dc 100644 --- a/MDANSE/Extensions/change_coordinates.pyx +++ b/MDANSE/Extensions/change_coordinates.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/distance_histogram.pyx -# @brief Implements module/class/test distance_histogram +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/com_trajectory.pyx b/MDANSE/Extensions/com_trajectory.pyx index b5eb8a3ee1..5974244f7c 100644 --- a/MDANSE/Extensions/com_trajectory.pyx +++ b/MDANSE/Extensions/com_trajectory.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/distance_histogram.pyx -# @brief Implements module/class/test distance_histogram +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import sys diff --git a/MDANSE/Extensions/contiguous_coordinates.pyx b/MDANSE/Extensions/contiguous_coordinates.pyx index 4eb6edf19d..62e62667d3 100644 --- a/MDANSE/Extensions/contiguous_coordinates.pyx +++ b/MDANSE/Extensions/contiguous_coordinates.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/distance_histogram.pyx -# @brief Implements module/class/test distance_histogram +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import sys diff --git a/MDANSE/Extensions/distance_histogram.pyx b/MDANSE/Extensions/distance_histogram.pyx index a75f5e143b..10e6459f84 100644 --- a/MDANSE/Extensions/distance_histogram.pyx +++ b/MDANSE/Extensions/distance_histogram.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/distance_histogram.pyx -# @brief Implements module/class/test distance_histogram +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython cimport numpy as np diff --git a/MDANSE/Extensions/fast_calculation.pyx b/MDANSE/Extensions/fast_calculation.pyx index aff25cff28..c094e3996c 100644 --- a/MDANSE/Extensions/fast_calculation.pyx +++ b/MDANSE/Extensions/fast_calculation.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/fast_calculation.pyx -# @brief Implements module/class/test fast_calculation +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/fold_coordinates.pyx b/MDANSE/Extensions/fold_coordinates.pyx index 745f82dd0c..c042c86d85 100644 --- a/MDANSE/Extensions/fold_coordinates.pyx +++ b/MDANSE/Extensions/fold_coordinates.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/distance_histogram.pyx -# @brief Implements module/class/test distance_histogram +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/mic_fast_calc.pyx b/MDANSE/Extensions/mic_fast_calc.pyx index 561fca5867..aec021fedb 100644 --- a/MDANSE/Extensions/mic_fast_calc.pyx +++ b/MDANSE/Extensions/mic_fast_calc.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/mic_fast_calc.pyx -# @brief Implements module/class/test mic_fast_calc +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) cimport numpy as np import numpy as np diff --git a/MDANSE/Extensions/mt_fast_calc.pyx b/MDANSE/Extensions/mt_fast_calc.pyx index 070d482f89..472aa67f83 100644 --- a/MDANSE/Extensions/mt_fast_calc.pyx +++ b/MDANSE/Extensions/mt_fast_calc.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/mt_fast_calc.pyx -# @brief Implements module/class/test mt_fast_calc +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython cimport numpy as np diff --git a/MDANSE/Extensions/qhull.pyx b/MDANSE/Extensions/qhull.pyx index 6c42c539f0..9cde27395c 100644 --- a/MDANSE/Extensions/qhull.pyx +++ b/MDANSE/Extensions/qhull.pyx @@ -1,23 +1,24 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments + +# This file is part of MDANSE. # -# @file Extensions/qhull.pyx -# @brief Implements module/class/test qhull +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# ************************************************************************** - +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now # Copyright (C) Pauli Virtanen, 2010. -# -# Distributed under the same BSD license as Scipy. -# +# Authors: Scientific Computing Group at ILL (see AUTHORS) + import threading diff --git a/MDANSE/Extensions/sas_fast_calc.pyx b/MDANSE/Extensions/sas_fast_calc.pyx index 55ff183876..daf7b39c86 100644 --- a/MDANSE/Extensions/sas_fast_calc.pyx +++ b/MDANSE/Extensions/sas_fast_calc.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/sas_fast_calc.pyx -# @brief Implements module/class/test sas_fast_calc +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/sd_fast_calc.pyx b/MDANSE/Extensions/sd_fast_calc.pyx index a2f2b8b0a1..9253869528 100644 --- a/MDANSE/Extensions/sd_fast_calc.pyx +++ b/MDANSE/Extensions/sd_fast_calc.pyx @@ -1,17 +1,22 @@ -# ************************************************************************** + +# This file is part of MDANSE. # -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# @file Extensions/sd_fast_calc.pyx -# @brief Implements module/class/test sd_fast_calc +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# ************************************************************************** +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython cimport numpy as np diff --git a/MDANSE/Extensions/xtc/trr.pyx b/MDANSE/Extensions/xtc/trr.pyx index afb2990504..6f68a461ae 100644 --- a/MDANSE/Extensions/xtc/trr.pyx +++ b/MDANSE/Extensions/xtc/trr.pyx @@ -1,45 +1,29 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Extensions/xtc/trr.pyx -# @brief Implements module/class/test trr -# -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -# cython: c_string_type=str, c_string_encoding=ascii -############################################################################## -# MDTraj: A Python Library for Loading, Saving, and Manipulating -# Molecular Dynamics Trajectories. -# Copyright 2012-2013 Stanford University and the Authors +# This file is part of MDANSE. # -# Authors: Robert McGibbon -# Contributors: +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# MDTraj is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation, either version 2.1 -# of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# You should have received a copy of the GNU Lesser General Public -# License along with MDTraj. If not, see . -############################################################################## +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Copyright (C) +# Copyright 2012-2013 Stanford University and the Authors +# Authors: Scientific Computing Group at ILL (see AUTHORS) +# Authors: Stanford University and the Authors +# Authors: Robert McGibbon + -############################################################################### -# Imports -############################################################################### import os import warnings diff --git a/MDANSE/Extensions/xtc/xtc.pyx b/MDANSE/Extensions/xtc/xtc.pyx index d42b67d471..9fbc56bd34 100644 --- a/MDANSE/Extensions/xtc/xtc.pyx +++ b/MDANSE/Extensions/xtc/xtc.pyx @@ -1,45 +1,28 @@ -# ************************************************************************** -# -# MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments -# -# @file Extensions/xtc/xtc.pyx -# @brief Implements module/class/test xtc -# -# @homepage https://mdanse.org -# @license GNU General Public License v3 or higher (see LICENSE) -# @copyright Institut Laue Langevin 2013-now -# @copyright ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# @authors Scientific Computing Group at ILL (see AUTHORS) -# -# ************************************************************************** -# cython: c_string_type=str, c_string_encoding=ascii -############################################################################## -# MDTraj: A Python Library for Loading, Saving, and Manipulating -# Molecular Dynamics Trajectories. -# Copyright 2012-2013 Stanford University and the Authors +# This file is part of MDANSE. # -# Authors: Robert McGibbon -# Contributors: +# MDANSE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# MDTraj is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation, either version 2.1 -# of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # -# You should have received a copy of the GNU Lesser General Public -# License along with MDTraj. If not, see . -############################################################################## +# Copyright (C) Institut Laue Langevin 2013-now +# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now +# Copyright (C) 2012-2013 Stanford University and the Authors +# Authors: Scientific Computing Group at ILL (see AUTHORS) +# Authors: Stanford University and the Authors +# Authors: Robert McGibbon + -############################################################################### -# Imports -############################################################################### import os import warnings From 8c96eb839be2864170f439c56750e8fc73ffc4ee Mon Sep 17 00:00:00 2001 From: Maciej Bartkowiak Date: Wed, 27 Mar 2024 12:11:29 +0000 Subject: [PATCH 04/11] Apply black to the GUI code --- MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py index f5b12a98f1..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Session/__init__.py @@ -13,4 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # - From df967931a33ba37e5d47cabd44e35250277c1c20 Mon Sep 17 00:00:00 2001 From: Maciej Bartkowiak Date: Wed, 27 Mar 2024 12:21:56 +0000 Subject: [PATCH 05/11] Restore the original license notice in the Cython extensions qhull.pyx, trr.pyx and xtc.pyx --- MDANSE/Extensions/qhull.pyx | 6 +++++- MDANSE/Extensions/xtc/trr.pyx | 22 +++++++++++++++++++++- MDANSE/Extensions/xtc/xtc.pyx | 22 +++++++++++++++++++++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/MDANSE/Extensions/qhull.pyx b/MDANSE/Extensions/qhull.pyx index 9cde27395c..f475661cda 100644 --- a/MDANSE/Extensions/qhull.pyx +++ b/MDANSE/Extensions/qhull.pyx @@ -18,7 +18,11 @@ # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now # Copyright (C) Pauli Virtanen, 2010. # Authors: Scientific Computing Group at ILL (see AUTHORS) - +# +# Copyright (C) Pauli Virtanen, 2010. +# +# Distributed under the same BSD license as Scipy. +# import threading diff --git a/MDANSE/Extensions/xtc/trr.pyx b/MDANSE/Extensions/xtc/trr.pyx index 6f68a461ae..957f661773 100644 --- a/MDANSE/Extensions/xtc/trr.pyx +++ b/MDANSE/Extensions/xtc/trr.pyx @@ -21,7 +21,27 @@ # Authors: Scientific Computing Group at ILL (see AUTHORS) # Authors: Stanford University and the Authors # Authors: Robert McGibbon - +############################################################################## +# MDTraj: A Python Library for Loading, Saving, and Manipulating +# Molecular Dynamics Trajectories. +# Copyright 2012-2013 Stanford University and the Authors +# +# Authors: Robert McGibbon +# Contributors: +# +# MDTraj is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, either version 2.1 +# of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with MDTraj. If not, see . +############################################################################## diff --git a/MDANSE/Extensions/xtc/xtc.pyx b/MDANSE/Extensions/xtc/xtc.pyx index 9fbc56bd34..170eb79a91 100644 --- a/MDANSE/Extensions/xtc/xtc.pyx +++ b/MDANSE/Extensions/xtc/xtc.pyx @@ -20,7 +20,27 @@ # Authors: Scientific Computing Group at ILL (see AUTHORS) # Authors: Stanford University and the Authors # Authors: Robert McGibbon - +############################################################################## +# MDTraj: A Python Library for Loading, Saving, and Manipulating +# Molecular Dynamics Trajectories. +# Copyright 2012-2013 Stanford University and the Authors +# +# Authors: Robert McGibbon +# Contributors: +# +# MDTraj is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, either version 2.1 +# of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with MDTraj. If not, see . +############################################################################## From 967c45b33c4b93b00cc06b6fc7c218a469fe8855 Mon Sep 17 00:00:00 2001 From: Maciej Bartkowiak Date: Wed, 27 Mar 2024 13:26:55 +0000 Subject: [PATCH 06/11] Bring back the missing Cython string specification --- MDANSE/Extensions/xtc/trr.pyx | 2 +- MDANSE/Extensions/xtc/xtc.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MDANSE/Extensions/xtc/trr.pyx b/MDANSE/Extensions/xtc/trr.pyx index 957f661773..711038cdd1 100644 --- a/MDANSE/Extensions/xtc/trr.pyx +++ b/MDANSE/Extensions/xtc/trr.pyx @@ -43,7 +43,7 @@ # License along with MDTraj. If not, see . ############################################################################## - +# cython: c_string_type=str, c_string_encoding=ascii import os import warnings diff --git a/MDANSE/Extensions/xtc/xtc.pyx b/MDANSE/Extensions/xtc/xtc.pyx index 170eb79a91..49b0a0d299 100644 --- a/MDANSE/Extensions/xtc/xtc.pyx +++ b/MDANSE/Extensions/xtc/xtc.pyx @@ -42,7 +42,7 @@ # License along with MDTraj. If not, see . ############################################################################## - +# cython: c_string_type=str, c_string_encoding=ascii import os import warnings From 981a7337e8aee383ddc91e9bb2941ac74dbce0ea Mon Sep 17 00:00:00 2001 From: Chi Cheng Date: Thu, 28 Mar 2024 10:00:05 +0000 Subject: [PATCH 07/11] removed authors from headers and removed MDANSE header from MDTraj code --- MDANSE/Extensions/atomic_trajectory.pyx | 1 - MDANSE/Extensions/atoms_in_shell.pyx | 1 - MDANSE/Extensions/change_coordinates.pyx | 1 - MDANSE/Extensions/com_trajectory.pyx | 1 - MDANSE/Extensions/contiguous_coordinates.pyx | 1 - MDANSE/Extensions/distance_histogram.pyx | 1 - MDANSE/Extensions/fast_calculation.pyx | 1 - MDANSE/Extensions/fold_coordinates.pyx | 1 - MDANSE/Extensions/mic_fast_calc.pyx | 1 - MDANSE/Extensions/mt_fast_calc.pyx | 1 - MDANSE/Extensions/qhull.pyx | 1 - MDANSE/Extensions/sas_fast_calc.pyx | 1 - MDANSE/Extensions/sd_fast_calc.pyx | 1 - MDANSE/Extensions/xtc/trr.pyx | 23 ------------------- MDANSE/Extensions/xtc/xtc.pyx | 22 ------------------ MDANSE/Src/MDANSE/Chemistry/Databases.py | 1 - MDANSE/Src/MDANSE/Core/Error.py | 1 - MDANSE/Src/MDANSE/Core/Platform.py | 1 - MDANSE/Src/MDANSE/Core/Singleton.py | 1 - MDANSE/Src/MDANSE/Core/__init__.py | 1 - MDANSE/Src/MDANSE/Extensions/__init__.py | 1 - MDANSE/Src/MDANSE/Framework/Configurable.py | 1 - .../Configurators/ASEFileConfigurator.py | 1 - .../Configurators/AseInputFileConfigurator.py | 1 - .../Configurators/AtomMappingConfigurator.py | 1 - .../AtomSelectionConfigurator.py | 1 - .../AtomTransmutationConfigurator.py | 1 - .../Configurators/AtomsListConfigurator.py | 1 - .../AxisSelectionConfigurator.py | 1 - .../BasisSelectionConfigurator.py | 1 - .../Configurators/BooleanConfigurator.py | 1 - .../Configurators/ConfigFileConfigurator.py | 1 - .../Configurators/FieldFileConfigurator.py | 1 - .../Configurators/FloatConfigurator.py | 1 - .../Configurators/FramesConfigurator.py | 1 - .../GroupingLevelConfigurator.py | 1 - .../Configurators/HDFInputFileConfigurator.py | 1 - .../HDFTrajectoryConfigurator.py | 1 - .../Framework/Configurators/IConfigurator.py | 1 - .../InputDirectoryConfigurator.py | 1 - .../Configurators/InputFileConfigurator.py | 1 - .../InstrumentResolutionConfigurator.py | 1 - .../Configurators/IntegerConfigurator.py | 1 - .../InterpolationOrderConfigurator.py | 1 - .../Configurators/MDFileConfigurator.py | 1 - .../MDMCTrajectoryConfigurator.py | 1 - .../McStasInstrumentConfigurator.py | 1 - .../McStasOptionsConfigurator.py | 1 - .../McStasParametersConfigurator.py | 1 - .../MockTrajectoryConfigurator.py | 1 - .../MultipleChoicesConfigurator.py | 1 - .../OutputDirectoryConfigurator.py | 1 - .../Configurators/OutputFilesConfigurator.py | 1 - .../OutputTrajectoryConfigurator.py | 1 - .../PartialChargeConfigurator.py | 1 - .../Configurators/ProjectionConfigurator.py | 1 - .../Configurators/PythonObjectConfigurator.py | 1 - .../Configurators/PythonScriptConfigurator.py | 1 - .../Configurators/QVectorsConfigurator.py | 1 - .../Configurators/RangeConfigurator.py | 1 - .../Configurators/RunningModeConfigurator.py | 1 - .../Configurators/SingleChoiceConfigurator.py | 1 - .../SingleOutputFileConfigurator.py | 1 - .../Configurators/StringConfigurator.py | 1 - .../TrajectoryVariableConfigurator.py | 1 - .../Configurators/VectorConfigurator.py | 1 - .../Configurators/WeightsConfigurator.py | 1 - .../Configurators/XDATCARFileConfigurator.py | 1 - .../Configurators/XTDFileConfigurator.py | 1 - .../Configurators/XYZFileConfigurator.py | 1 - .../Framework/Configurators/__init__.py | 1 - MDANSE/Src/MDANSE/Framework/Converters/ASE.py | 1 - .../Src/MDANSE/Framework/Converters/CASTEP.py | 1 - .../Src/MDANSE/Framework/Converters/CHARMM.py | 1 - .../Src/MDANSE/Framework/Converters/CP2K.py | 1 - .../MDANSE/Framework/Converters/Converter.py | 1 - MDANSE/Src/MDANSE/Framework/Converters/DCD.py | 1 - .../Src/MDANSE/Framework/Converters/DFTB.py | 1 - .../MDANSE/Framework/Converters/DL_POLY.py | 1 - .../Src/MDANSE/Framework/Converters/DMol.py | 1 - .../MDANSE/Framework/Converters/Discover.py | 1 - .../MDANSE/Framework/Converters/Forcite.py | 1 - .../MDANSE/Framework/Converters/Gromacs.py | 1 - .../Framework/Converters/ImprovedASE.py | 1 - .../Src/MDANSE/Framework/Converters/LAMMPS.py | 1 - .../Src/MDANSE/Framework/Converters/NAMD.py | 1 - .../Src/MDANSE/Framework/Converters/VASP.py | 1 - .../Src/MDANSE/Framework/Converters/XPLOR.py | 1 - .../MDANSE/Framework/Converters/__init__.py | 1 - .../Src/MDANSE/Framework/Formats/HDFFormat.py | 1 - .../Src/MDANSE/Framework/Formats/IFormat.py | 1 - .../Src/MDANSE/Framework/Formats/SVGFormat.py | 1 - .../MDANSE/Framework/Formats/TextFormat.py | 1 - .../Src/MDANSE/Framework/Formats/__init__.py | 1 - .../Handlers/ColorizingStreamHandler.py | 1 - .../Src/MDANSE/Framework/Handlers/IHandler.py | 1 - .../Framework/Handlers/LogfileHandler.py | 1 - .../Src/MDANSE/Framework/Handlers/__init__.py | 1 - .../MDANSE/Framework/InputData/EmptyData.py | 1 - .../InputData/HDFTrajectoryInputData.py | 1 - .../MDANSE/Framework/InputData/IInputData.py | 1 - .../Framework/InputData/InputFileData.py | 1 - .../Framework/InputData/MVITraceInputData.py | 1 - .../InputData/MockTrajectoryInputData.py | 1 - .../InputData/PeriodicTableInputData.py | 1 - .../MDANSE/Framework/InputData/__init__.py | 1 - .../InstrumentResolutions/Gaussian.py | 1 - .../IInstrumentResolution.py | 1 - .../Framework/InstrumentResolutions/Ideal.py | 1 - .../InstrumentResolutions/Lorentzian.py | 1 - .../InstrumentResolutions/PseudoVoigt.py | 1 - .../Framework/InstrumentResolutions/Square.py | 1 - .../InstrumentResolutions/Triangular.py | 1 - .../InstrumentResolutions/__init__.py | 1 - .../Framework/Jobs/AngularCorrelation.py | 1 - .../MDANSE/Framework/Jobs/AreaPerMolecule.py | 1 - .../Jobs/CenterOfMassesTrajectory.py | 1 - .../Framework/Jobs/CoordinationNumber.py | 1 - .../Framework/Jobs/CroppedTrajectory.py | 1 - .../Jobs/CurrentCorrelationFunction.py | 1 - MDANSE/Src/MDANSE/Framework/Jobs/Density.py | 1 - .../MDANSE/Framework/Jobs/DensityOfStates.py | 1 - .../MDANSE/Framework/Jobs/DensityProfile.py | 1 - .../Jobs/DipoleAutoCorrelationFunction.py | 1 - .../Framework/Jobs/DistanceHistogram.py | 1 - .../Jobs/DynamicCoherentStructureFactor.py | 1 - .../Jobs/DynamicIncoherentStructureFactor.py | 1 - .../Src/MDANSE/Framework/Jobs/Eccentricity.py | 1 - .../Jobs/ElasticIncoherentStructureFactor.py | 1 - ...aussianDynamicIncoherentStructureFactor.py | 1 - .../Jobs/GeneralAutoCorrelationFunction.py | 1 - .../Jobs/GlobalMotionFilteredTrajectory.py | 1 - MDANSE/Src/MDANSE/Framework/Jobs/IJob.py | 1 - MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py | 1 - .../Framework/Jobs/McStasVirtualInstrument.py | 1 - .../Framework/Jobs/MeanSquareDisplacement.py | 1 - .../MDANSE/Framework/Jobs/MolecularTrace.py | 1 - .../MDANSE/Framework/Jobs/MoleculeFinder.py | 1 - .../NeutronDynamicTotalStructureFactor.py | 1 - .../MDANSE/Framework/Jobs/OrderParameter.py | 1 - .../Jobs/PairDistributionFunction.py | 1 - .../Jobs/PositionAutoCorrelationFunction.py | 1 - .../MDANSE/Framework/Jobs/RadiusOfGyration.py | 1 - .../Framework/Jobs/RigidBodyTrajectory.py | 1 - .../Framework/Jobs/RootMeanSquareDeviation.py | 1 - .../Jobs/RootMeanSquareFluctuation.py | 1 - .../Jobs/SolventAccessibleSurface.py | 1 - .../Framework/Jobs/StaticStructureFactor.py | 1 - .../StructureFactorFromScatteringFunction.py | 1 - .../Src/MDANSE/Framework/Jobs/Temperature.py | 1 - .../Framework/Jobs/UnfoldedTrajectory.py | 1 - .../Jobs/VelocityAutoCorrelationFunction.py | 1 - MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py | 1 - .../Jobs/XRayStaticStructureFactor.py | 1 - MDANSE/Src/MDANSE/Framework/Jobs/__init__.py | 1 - .../OutputVariables/IOutputVariable.py | 1 - .../OutputVariables/LineOutputVariable.py | 1 - .../OutputVariables/SurfaceOutputVariable.py | 1 - .../OutputVariables/VolumeOutputVariable.py | 1 - .../Framework/OutputVariables/__init__.py | 1 - .../Framework/Projectors/AxialProjector.py | 1 - .../MDANSE/Framework/Projectors/IProjector.py | 1 - .../Framework/Projectors/NullProjector.py | 1 - .../Framework/Projectors/PlanarProjector.py | 1 - .../MDANSE/Framework/Projectors/__init__.py | 1 - .../QVectors/ApproximateDispersionQVectors.py | 1 - .../QVectors/CircularLatticeQVectors.py | 1 - .../Framework/QVectors/CircularQVectors.py | 1 - .../QVectors/DispersionLatticeQVectors.py | 1 - .../MDANSE/Framework/QVectors/GridQVectors.py | 1 - .../MDANSE/Framework/QVectors/IQVectors.py | 1 - .../Framework/QVectors/LatticeQVectors.py | 1 - .../QVectors/LinearLatticeQVectors.py | 1 - .../Framework/QVectors/LinearQVectors.py | 1 - .../QVectors/MillerIndicesQVectors.py | 1 - .../QVectors/SphericalLatticeQVectors.py | 1 - .../Framework/QVectors/SphericalQVectors.py | 1 - .../Src/MDANSE/Framework/QVectors/__init__.py | 1 - .../Framework/Session/CurrentSession.py | 1 - MDANSE/Src/MDANSE/Framework/Status.py | 1 - .../MDANSE/Framework/UserDefinitionStore.py | 1 - MDANSE/Src/MDANSE/Framework/__init__.py | 1 - MDANSE/Src/MDANSE/IO/HDF5.py | 1 - MDANSE/Src/MDANSE/IO/IOUtils.py | 1 - MDANSE/Src/MDANSE/IO/__init__.py | 1 - MDANSE/Src/MDANSE/Mathematics/Arithmetic.py | 1 - MDANSE/Src/MDANSE/Mathematics/Geometry.py | 1 - MDANSE/Src/MDANSE/Mathematics/Graph.py | 1 - MDANSE/Src/MDANSE/Mathematics/Signal.py | 1 - MDANSE/Src/MDANSE/Mathematics/__init__.py | 1 - .../Src/MDANSE/MolecularDynamics/Analysis.py | 1 - .../MolecularDynamics/MockTrajectory.py | 1 - .../MDANSE/MolecularDynamics/Trajectory.py | 1 - .../MolecularDynamics/TrajectoryUtils.py | 1 - .../Src/MDANSE/MolecularDynamics/__init__.py | 1 - MDANSE/Src/MDANSE/Scripts/mdanse.py | 1 - MDANSE/Src/MDANSE/Scripts/mdanse_job.py | 1 - MDANSE/Src/MDANSE/__init__.py | 1 - MDANSE/Src/MDANSE/__pkginfo__.py | 1 - .../Src/MDANSE_GUI/DataViewModel/__init__.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py | 1 - .../InputWidgets/AseInputFileWidget.py | 1 - .../InputWidgets/AtomMappingWidget.py | 1 - .../InputWidgets/AtomSelectionWidget.py | 1 - .../InputWidgets/AtomTransmutationWidget.py | 1 - .../MDANSE_GUI/InputWidgets/BackupWidget.py | 1 - .../MDANSE_GUI/InputWidgets/BooleanWidget.py | 1 - .../MDANSE_GUI/InputWidgets/ComboWidget.py | 1 - .../MDANSE_GUI/InputWidgets/DummyWidget.py | 1 - .../MDANSE_GUI/InputWidgets/FloatWidget.py | 1 - .../MDANSE_GUI/InputWidgets/FramesWidget.py | 1 - .../InputWidgets/HDFTrajectoryWidget.py | 1 - .../InputWidgets/InputDirectoryWidget.py | 1 - .../InputWidgets/InputFileWidget.py | 1 - .../InstrumentResolutionWidget.py | 1 - .../MDANSE_GUI/InputWidgets/IntegerWidget.py | 1 - .../InputWidgets/InterpolationOrderWidget.py | 1 - .../InputWidgets/OutputDirectoryWidget.py | 1 - .../InputWidgets/OutputFilesWidget.py | 1 - .../InputWidgets/OutputTrajectoryWidget.py | 1 - .../InputWidgets/ProjectionWidget.py | 1 - .../MDANSE_GUI/InputWidgets/QVectorsWidget.py | 1 - .../MDANSE_GUI/InputWidgets/RangeWidget.py | 1 - .../InputWidgets/RunningModeWidget.py | 1 - .../MDANSE_GUI/InputWidgets/StringWidget.py | 1 - .../Src/MDANSE_GUI/InputWidgets/WidgetBase.py | 1 - .../Src/MDANSE_GUI/InputWidgets/__init__.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py | 1 - .../Scripts/mdanse_elements_database.py | 1 - .../Src/MDANSE_GUI/Scripts/mdanse_gui.py | 1 - .../Scripts/mdanse_periodic_table.py | 1 - .../Src/MDANSE_GUI/Scripts/mdanse_plotter.py | 1 - .../MDANSE_GUI/Scripts/mdanse_units_editor.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py | 1 - .../Src/MDANSE_GUI/Tabs/ConverterTab.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py | 1 - .../Src/MDANSE_GUI/Tabs/TrajectoryTab.py | 1 - .../Src/MDANSE_GUI/Tabs/Views/RunTable.py | 1 - .../MDANSE_GUI/Tabs/Views/TrajectoryView.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/__init__.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py | 1 - 246 files changed, 289 deletions(-) diff --git a/MDANSE/Extensions/atomic_trajectory.pyx b/MDANSE/Extensions/atomic_trajectory.pyx index 53fa1b2882..3405c90488 100644 --- a/MDANSE/Extensions/atomic_trajectory.pyx +++ b/MDANSE/Extensions/atomic_trajectory.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/atoms_in_shell.pyx b/MDANSE/Extensions/atoms_in_shell.pyx index 193b9853a4..8f1f395dfd 100644 --- a/MDANSE/Extensions/atoms_in_shell.pyx +++ b/MDANSE/Extensions/atoms_in_shell.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/change_coordinates.pyx b/MDANSE/Extensions/change_coordinates.pyx index 3691f537dc..5efd3edd0e 100644 --- a/MDANSE/Extensions/change_coordinates.pyx +++ b/MDANSE/Extensions/change_coordinates.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/com_trajectory.pyx b/MDANSE/Extensions/com_trajectory.pyx index 5974244f7c..3f3e4b191a 100644 --- a/MDANSE/Extensions/com_trajectory.pyx +++ b/MDANSE/Extensions/com_trajectory.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import sys diff --git a/MDANSE/Extensions/contiguous_coordinates.pyx b/MDANSE/Extensions/contiguous_coordinates.pyx index 62e62667d3..92a1d21f33 100644 --- a/MDANSE/Extensions/contiguous_coordinates.pyx +++ b/MDANSE/Extensions/contiguous_coordinates.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import sys diff --git a/MDANSE/Extensions/distance_histogram.pyx b/MDANSE/Extensions/distance_histogram.pyx index 10e6459f84..53acdbb7e8 100644 --- a/MDANSE/Extensions/distance_histogram.pyx +++ b/MDANSE/Extensions/distance_histogram.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython cimport numpy as np diff --git a/MDANSE/Extensions/fast_calculation.pyx b/MDANSE/Extensions/fast_calculation.pyx index c094e3996c..accf2f5236 100644 --- a/MDANSE/Extensions/fast_calculation.pyx +++ b/MDANSE/Extensions/fast_calculation.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/fold_coordinates.pyx b/MDANSE/Extensions/fold_coordinates.pyx index c042c86d85..9edaab1e2a 100644 --- a/MDANSE/Extensions/fold_coordinates.pyx +++ b/MDANSE/Extensions/fold_coordinates.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/mic_fast_calc.pyx b/MDANSE/Extensions/mic_fast_calc.pyx index aec021fedb..0737cbd55e 100644 --- a/MDANSE/Extensions/mic_fast_calc.pyx +++ b/MDANSE/Extensions/mic_fast_calc.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) cimport numpy as np import numpy as np diff --git a/MDANSE/Extensions/mt_fast_calc.pyx b/MDANSE/Extensions/mt_fast_calc.pyx index 472aa67f83..499dbed930 100644 --- a/MDANSE/Extensions/mt_fast_calc.pyx +++ b/MDANSE/Extensions/mt_fast_calc.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython cimport numpy as np diff --git a/MDANSE/Extensions/qhull.pyx b/MDANSE/Extensions/qhull.pyx index f475661cda..b72b6c25f0 100644 --- a/MDANSE/Extensions/qhull.pyx +++ b/MDANSE/Extensions/qhull.pyx @@ -17,7 +17,6 @@ # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now # Copyright (C) Pauli Virtanen, 2010. -# Authors: Scientific Computing Group at ILL (see AUTHORS) # # Copyright (C) Pauli Virtanen, 2010. # diff --git a/MDANSE/Extensions/sas_fast_calc.pyx b/MDANSE/Extensions/sas_fast_calc.pyx index daf7b39c86..5e4aa11c13 100644 --- a/MDANSE/Extensions/sas_fast_calc.pyx +++ b/MDANSE/Extensions/sas_fast_calc.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython import numpy as np diff --git a/MDANSE/Extensions/sd_fast_calc.pyx b/MDANSE/Extensions/sd_fast_calc.pyx index 9253869528..11b6cc701c 100644 --- a/MDANSE/Extensions/sd_fast_calc.pyx +++ b/MDANSE/Extensions/sd_fast_calc.pyx @@ -16,7 +16,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import cython cimport numpy as np diff --git a/MDANSE/Extensions/xtc/trr.pyx b/MDANSE/Extensions/xtc/trr.pyx index 711038cdd1..a88783fffe 100644 --- a/MDANSE/Extensions/xtc/trr.pyx +++ b/MDANSE/Extensions/xtc/trr.pyx @@ -1,26 +1,3 @@ - -# This file is part of MDANSE. -# -# MDANSE is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Copyright (C) -# Copyright 2012-2013 Stanford University and the Authors -# Authors: Scientific Computing Group at ILL (see AUTHORS) -# Authors: Stanford University and the Authors -# Authors: Robert McGibbon ############################################################################## # MDTraj: A Python Library for Loading, Saving, and Manipulating # Molecular Dynamics Trajectories. diff --git a/MDANSE/Extensions/xtc/xtc.pyx b/MDANSE/Extensions/xtc/xtc.pyx index 49b0a0d299..898af2c88c 100644 --- a/MDANSE/Extensions/xtc/xtc.pyx +++ b/MDANSE/Extensions/xtc/xtc.pyx @@ -1,25 +1,3 @@ - -# This file is part of MDANSE. -# -# MDANSE is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Copyright (C) 2012-2013 Stanford University and the Authors -# Authors: Scientific Computing Group at ILL (see AUTHORS) -# Authors: Stanford University and the Authors -# Authors: Robert McGibbon ############################################################################## # MDTraj: A Python Library for Loading, Saving, and Manipulating # Molecular Dynamics Trajectories. diff --git a/MDANSE/Src/MDANSE/Chemistry/Databases.py b/MDANSE/Src/MDANSE/Chemistry/Databases.py index c6aa47f69f..48a7349ec1 100644 --- a/MDANSE/Src/MDANSE/Chemistry/Databases.py +++ b/MDANSE/Src/MDANSE/Chemistry/Databases.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import copy import os diff --git a/MDANSE/Src/MDANSE/Core/Error.py b/MDANSE/Src/MDANSE/Core/Error.py index b1132a772b..07b964247b 100644 --- a/MDANSE/Src/MDANSE/Core/Error.py +++ b/MDANSE/Src/MDANSE/Core/Error.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) class Error(Exception): diff --git a/MDANSE/Src/MDANSE/Core/Platform.py b/MDANSE/Src/MDANSE/Core/Platform.py index 0bb119e05e..47a14fce2b 100644 --- a/MDANSE/Src/MDANSE/Core/Platform.py +++ b/MDANSE/Src/MDANSE/Core/Platform.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc import ctypes diff --git a/MDANSE/Src/MDANSE/Core/Singleton.py b/MDANSE/Src/MDANSE/Core/Singleton.py index e58ff8abe2..0a62ea343e 100644 --- a/MDANSE/Src/MDANSE/Core/Singleton.py +++ b/MDANSE/Src/MDANSE/Core/Singleton.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) class Singleton(type): diff --git a/MDANSE/Src/MDANSE/Core/__init__.py b/MDANSE/Src/MDANSE/Core/__init__.py index 7b93366a0f..8babc2272a 100644 --- a/MDANSE/Src/MDANSE/Core/__init__.py +++ b/MDANSE/Src/MDANSE/Core/__init__.py @@ -15,4 +15,3 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/Extensions/__init__.py b/MDANSE/Src/MDANSE/Extensions/__init__.py index 7b93366a0f..8babc2272a 100644 --- a/MDANSE/Src/MDANSE/Extensions/__init__.py +++ b/MDANSE/Src/MDANSE/Extensions/__init__.py @@ -15,4 +15,3 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/Framework/Configurable.py b/MDANSE/Src/MDANSE/Framework/Configurable.py index 15ea36b13d..cdc4302739 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurable.py +++ b/MDANSE/Src/MDANSE/Framework/Configurable.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py index 06c86141d4..21fde5745f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from ase.io import iread, read from ase.io.trajectory import Trajectory as ASETrajectory diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py index 26d16e1e57..22d64f2c06 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py index 1a54ba7a35..9651391957 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import json from MDANSE.Framework.AtomMapping import fill_remaining_labels, check_mapping_valid diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py index bfc0e148a1..95cbe38b0a 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import operator from MDANSE.Chemistry import ATOMS_DATABASE from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py index 5e9c77f6f1..40f2dd9f56 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Chemistry import ATOMS_DATABASE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py index 644fc9cc1c..85e6d302e1 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.UserDefinitionStore import UD_STORE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py index acf4bd2aa1..2343d38d37 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.UserDefinitionStore import UD_STORE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py index 3bd00e132f..79b5ca997f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.UserDefinitionStore import UD_STORE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py index 3fde95a013..fff73a4503 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py index eb94b25949..708bc82c71 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py index 99f2d92be9..7f38c9abd7 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import re from MDANSE.Chemistry.ChemicalEntity import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py index cc783f0cef..bf951edb94 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py index 6886a08bd9..20eff0d4f3 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py index a9d4d73a91..c4b8a69830 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py index 1f27b69079..2778c64659 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import h5py diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py index 9e102ac10c..59781bbf56 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py index 34d9d836f1..8f6aae384b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py index b0aa6c085c..819bbdab75 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py index 537224d95b..7a50c982e0 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py index bc1b6b2203..e9724a7a7b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py index 86aa2881ed..e96d84a51f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py index 8d2372d02d..1c1ee82ea0 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py index c2d16feb1b..0c624c8d3a 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import itertools import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py index 4cd90bd1b7..14d3586a95 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py index dd41e71d4a..9ba847a93b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py index 810e718660..1c3456167b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import tempfile diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py index 654d511594..b3446ee03b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import re diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py index 746935943f..5bbe400d94 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py index 49043b6421..b0f9e9af3d 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py index 79d94cfe1c..e04992807b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py index c575494b84..a4382ed31c 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import tempfile diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py index bf98c46386..b0a9ba3334 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py index 7418a3c907..c6a845683c 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py index 8fa5656b7b..af632710e0 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py index 9994660bf4..3968a5c2da 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import ast diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py index 1365621432..a1b4010cc6 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py index 88deea4ad4..9071de60c7 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.UserDefinitionStore import UD_STORE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py index 1f8a728cee..72e0c62308 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py index 0ae94b6700..b9e7e28813 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import multiprocessing diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py index 143b02632e..496930d650 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py index bb3482129e..1b4fc5dd48 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os from MDANSE import PLATFORM from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py index 78eb16aa52..3bf8e75b76 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import ast diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py index 0b2e53506b..767911b689 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py index f88785f454..824216de4f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py index dba06b2183..7450002c83 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Chemistry import ATOMS_DATABASE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py index 875ace2a05..ed89b3e88b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py index f6ba08d8dd..e6e82e9b86 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import xml.etree.ElementTree as ElementTree diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py index 55a52d1459..ac364869c8 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py b/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py index 6e3f0c890e..689c5f64c7 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/ASE.py b/MDANSE/Src/MDANSE/Framework/Converters/ASE.py index a14777e8e4..e1524a8b91 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/ASE.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/ASE.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py b/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py index f62bc4176a..26329d7eab 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections from MDANSE.Chemistry.ChemicalEntity import Atom, ChemicalSystem diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py b/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py index 686f4790a0..a0333b635e 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py b/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py index f27248865c..79069eb95b 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Converter.py b/MDANSE/Src/MDANSE/Framework/Converters/Converter.py index a471b93f17..8256cf46f2 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Converter.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Converter.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from abc import ABCMeta, abstractmethod, abstractclassmethod diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DCD.py b/MDANSE/Src/MDANSE/Framework/Converters/DCD.py index 35b07ca90f..f5acc8be18 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DCD.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DCD.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py b/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py index 763c186758..a8de91ee55 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py b/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py index 0b16f6eb43..07edf5a96c 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DMol.py b/MDANSE/Src/MDANSE/Framework/Converters/DMol.py index e4ad170f11..437b8c9158 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DMol.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DMol.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Converters.Discover import Discover diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Discover.py b/MDANSE/Src/MDANSE/Framework/Converters/Discover.py index e739b13472..781ba59cab 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Discover.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Discover.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import struct import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py b/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py index 549a8d3a3c..2b004d4486 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import struct diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py b/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py index 0e8deb3cb0..03416807a7 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py b/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py index c4a2d548f8..d7bc942d21 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py b/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py index 14052f153a..200f367010 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py b/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py index 08747df246..bcb3e6ef5d 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Converters.Converter import Converter from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/VASP.py b/MDANSE/Src/MDANSE/Framework/Converters/VASP.py index 83739771ce..caecc9ef4e 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/VASP.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/VASP.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py b/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py index 606d88564d..068c80a400 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/__init__.py b/MDANSE/Src/MDANSE/Framework/Converters/__init__.py index 53b9fc0491..883819ca70 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py index 124aad0e97..dd19a7b928 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import h5py from MDANSE.Framework.Formats.IFormat import IFormat diff --git a/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py index ac9ca93766..692a032edd 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py index c3cceb064b..a7d38066c6 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import re diff --git a/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py index bb0de2b437..97eda64d1e 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os import io diff --git a/MDANSE/Src/MDANSE/Framework/Formats/__init__.py b/MDANSE/Src/MDANSE/Framework/Formats/__init__.py index 3d42b2985b..c8ab035944 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py index 0f5a2de34c..bada9842b4 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import ctypes import logging diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py index 56bce6ada6..5a13da1793 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py index 754e864b2c..38d0c4ea16 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import logging.handlers diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py b/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py index 8759790dfa..f1f1f48adc 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py b/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py index f2c2990ee6..f98c146d14 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.IInputData import IInputData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py index b5d5173763..f6e6501628 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.IInputData import InputDataError diff --git a/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py index 9cfe02d1eb..e883ab8f17 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py b/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py index 203b8c03e9..927953c30b 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc import os diff --git a/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py index b0456580ae..ace9f054a3 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.InputFileData import InputFileData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py index 2d23961bc5..1a3cb7b1d6 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.IInputData import InputDataError from MDANSE.Framework.InputData.InputFileData import InputFileData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py index 89298fd301..0b8b32a12b 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.InputData.IInputData import IInputData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/__init__.py b/MDANSE/Src/MDANSE/Framework/InputData/__init__.py index bd0c2c8165..6718b52fec 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py index f6083da55e..e2502453f1 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py index 76f053decf..388b67aae4 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py index da6cd2272e..0c373d9747 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py index 029a7ad14b..a22011034d 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py index 1b72eab7d9..a90754f78d 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py index af9266c9bc..7b4a3b3122 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py index ffbe2fd9fc..cb659b1057 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py index eeb2ee0c42..ca0852c20e 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py b/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py index 6581bf6714..7fba5bb54a 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py b/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py index fe06fb18ea..c43e0ef074 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py index 8a84809346..4cda1945f6 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py b/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py index 7febd12ae5..c00e61a755 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py index ca1daf4a2a..eb4c0d63f5 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py index 5b3691ed4d..bab2ec07e4 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Density.py b/MDANSE/Src/MDANSE/Framework/Jobs/Density.py index a711ac99d9..ae6f54a9b4 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Density.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Density.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py b/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py index 228a534e84..4f12a8f6d4 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py b/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py index 81010d3407..0e66746b13 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py index 055e3cd053..906b492347 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py b/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py index 6623aaad4f..72f9ad08e7 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py index 47104e6e90..aa6689f033 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py index 13b144a07b..d6c2dce76d 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py b/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py index 2febc67ae8..d5a6d85073 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py index ecedf4f7f2..ab23466e08 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py index b790774f38..f9f2fcd643 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py index 4dd775acaf..17d119e9b9 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py index a1cf52df68..569e3d5e0e 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import copy diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py b/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py index bff328fbda..586bdc4998 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc import glob diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py b/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py index 1ac9193dec..8c457d59b8 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import pickle diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py b/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py index 373d5af48d..f99b29e7d1 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py b/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py index ce9e60fa73..de5a3aac6a 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py b/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py index 40711929c6..0f7874c51a 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py b/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py index 864a95a28d..2086c1c5ff 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py index 053db55c8e..b0023f14d0 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py b/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py index a4f7b1d9bd..52c000d1e9 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py index e3636f72c1..362664c80f 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py index 1d48316487..df2c4fbd7e 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py b/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py index a73318c411..f0eb33bd8d 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py index 28062133df..f7b6d8988f 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py index 1452756f9b..4fc4f1db50 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py index d72d3d3a2c..f84941451d 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py b/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py index c2b6d9ed97..45b7d34f23 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py index 009c0f6303..4240cd5504 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py index 2c923ba59b..75f6a1e0bb 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py b/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py index 25a47fe5b9..610998f0f5 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py index 10c3e32f69..ba0f3c57e6 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py index f97fa251a1..6a68bc0e62 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py b/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py index abf051b58e..faea30ab66 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import math diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py index b180615dba..8f646d251f 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py b/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py index 849ab4e315..3dcc89b46b 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py index 73f162441c..c28993a247 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py index 26784c885c..b21306cc92 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py index b5784a8b7f..8f8308ab3e 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py index 846fd441a1..c6d96494f2 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py index d58dc5a672..432237a4ea 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py index dbfa5dd3d9..79bc0a076d 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py index d220343364..feaa81030e 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py index 5d91219ade..7def2e2086 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from MDANSE.Framework.Projectors.IProjector import IProjector diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py index 6aba720101..ede6c0332e 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py b/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py index 940f4739cd..8a1396c56f 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py index e34cb6987a..5ff149e643 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py index cf58ea40f8..452363b4a4 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import random diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py index 3fecead344..399d7a6c39 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py index e100310265..71bb24e977 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py index 5ab51785d3..56fa4a8fef 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py index 227956d4df..ef4b940c71 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py index 5a52f0fa9b..94e7304338 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py index ad0883d06f..6bde09b990 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import random diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py index 7c957132f6..7a7b123ba1 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py index fbf997f777..4cee2a6423 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py index 0e9b68d9df..8194804adf 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections import random diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py index d915c729dd..4d823d5bb8 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py b/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py index b02b79ba6f..a2622f0437 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py b/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py index 07690df305..a8fb047254 100644 --- a/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py +++ b/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os from os.path import expanduser diff --git a/MDANSE/Src/MDANSE/Framework/Status.py b/MDANSE/Src/MDANSE/Framework/Status.py index d117a5abea..24f3b9d1c9 100644 --- a/MDANSE/Src/MDANSE/Framework/Status.py +++ b/MDANSE/Src/MDANSE/Framework/Status.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc diff --git a/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py b/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py index 2f32251cef..0b1c79f2eb 100644 --- a/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py +++ b/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import pickle import os diff --git a/MDANSE/Src/MDANSE/Framework/__init__.py b/MDANSE/Src/MDANSE/Framework/__init__.py index 7b93366a0f..8babc2272a 100644 --- a/MDANSE/Src/MDANSE/Framework/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/__init__.py @@ -15,4 +15,3 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/IO/HDF5.py b/MDANSE/Src/MDANSE/IO/HDF5.py index 47ffa7e2ab..1c069925f9 100644 --- a/MDANSE/Src/MDANSE/IO/HDF5.py +++ b/MDANSE/Src/MDANSE/IO/HDF5.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import h5py import numpy as np diff --git a/MDANSE/Src/MDANSE/IO/IOUtils.py b/MDANSE/Src/MDANSE/IO/IOUtils.py index 4d54e64196..936bfb2480 100644 --- a/MDANSE/Src/MDANSE/IO/IOUtils.py +++ b/MDANSE/Src/MDANSE/IO/IOUtils.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import abc from collections import OrderedDict diff --git a/MDANSE/Src/MDANSE/IO/__init__.py b/MDANSE/Src/MDANSE/IO/__init__.py index 7b93366a0f..8babc2272a 100644 --- a/MDANSE/Src/MDANSE/IO/__init__.py +++ b/MDANSE/Src/MDANSE/IO/__init__.py @@ -15,4 +15,3 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py b/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py index 160ee20eb5..f50afa42fc 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py +++ b/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import math import cmath diff --git a/MDANSE/Src/MDANSE/Mathematics/Geometry.py b/MDANSE/Src/MDANSE/Mathematics/Geometry.py index 7ba4e31f0b..9c9e715a66 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Geometry.py +++ b/MDANSE/Src/MDANSE/Mathematics/Geometry.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np from numpy.linalg import det diff --git a/MDANSE/Src/MDANSE/Mathematics/Graph.py b/MDANSE/Src/MDANSE/Mathematics/Graph.py index 947b4af317..ec14bb56cf 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Graph.py +++ b/MDANSE/Src/MDANSE/Mathematics/Graph.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import collections diff --git a/MDANSE/Src/MDANSE/Mathematics/Signal.py b/MDANSE/Src/MDANSE/Mathematics/Signal.py index e60ecf49e6..f3344dd308 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Signal.py +++ b/MDANSE/Src/MDANSE/Mathematics/Signal.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/Mathematics/__init__.py b/MDANSE/Src/MDANSE/Mathematics/__init__.py index 7b93366a0f..8babc2272a 100644 --- a/MDANSE/Src/MDANSE/Mathematics/__init__.py +++ b/MDANSE/Src/MDANSE/Mathematics/__init__.py @@ -15,4 +15,3 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py b/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py index d6064ad578..f2f85301b2 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import numpy as np from numpy.typing import NDArray diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py b/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py index 744db08474..c45e4f4958 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py @@ -14,7 +14,6 @@ # along with this program. If not, see . # # Copyright (C) Institut Laue Langevin 2013-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import math import json diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py b/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py index f18a09073d..a11f8f2588 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py @@ -14,7 +14,6 @@ # along with this program. If not, see . # # Copyright (C) Institut Laue Langevin 2013-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from ast import operator import os diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py b/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py index 2c7a1a7a6c..ea3414ea2d 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py @@ -14,7 +14,6 @@ # along with this program. If not, see . # # Copyright (C) Institut Laue Langevin 2013-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import operator from typing import Union, Iterable diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py b/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py index 7b93366a0f..8babc2272a 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py @@ -15,4 +15,3 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE/Src/MDANSE/Scripts/mdanse.py b/MDANSE/Src/MDANSE/Scripts/mdanse.py index ed4cf689c0..8ad305d70a 100644 --- a/MDANSE/Src/MDANSE/Scripts/mdanse.py +++ b/MDANSE/Src/MDANSE/Scripts/mdanse.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import pickle import glob diff --git a/MDANSE/Src/MDANSE/Scripts/mdanse_job.py b/MDANSE/Src/MDANSE/Scripts/mdanse_job.py index 2e26dda663..687294cc11 100644 --- a/MDANSE/Src/MDANSE/Scripts/mdanse_job.py +++ b/MDANSE/Src/MDANSE/Scripts/mdanse_job.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import argparse import sys diff --git a/MDANSE/Src/MDANSE/__init__.py b/MDANSE/Src/MDANSE/__init__.py index 7f1936a70b..305d0f9704 100644 --- a/MDANSE/Src/MDANSE/__init__.py +++ b/MDANSE/Src/MDANSE/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import warnings diff --git a/MDANSE/Src/MDANSE/__pkginfo__.py b/MDANSE/Src/MDANSE/__pkginfo__.py index f2ea4f8c96..173efefd97 100644 --- a/MDANSE/Src/MDANSE/__pkginfo__.py +++ b/MDANSE/Src/MDANSE/__pkginfo__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) __description__ = "Analysis of Molecular Dynamics trajectories" diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py index 643cca110b..c440bd180d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py @@ -15,4 +15,3 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py index 17e85eb762..62596886f8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py index 0603d9651c..c80f918291 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QPushButton, QFileDialog, QComboBox from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py index 4e62700864..1f8db7fb45 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import json from collections import defaultdict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py index 1bd9a32ef6..2f03484a31 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from typing import Union, Iterator from itertools import count, groupby from qtpy.QtCore import Qt, QEvent, Slot, QObject diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py index 2d67eff4a7..a2054474d4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py index dc4f0dfce6..07dbfd0511 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from icecream import ic from qtpy.QtWidgets import QLineEdit diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py index 6291835147..0adcbdacde 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QCheckBox from qtpy.QtCore import Slot, Qt diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py index 173cf6c69b..6f8d932e25 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QComboBox from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py index b716106b5b..19b6b7bcda 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py index 3e859a8c3f..d2bb6f8487 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QDoubleSpinBox from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py index e84995b9f4..fca4dc6a65 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py index b75bafdf36..d4c62432cc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os from qtpy.QtWidgets import QLabel diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py index 1c9399e81f..58cd6d2cd2 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QFileDialog diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py index 5e73ac9fb6..6211f18a2f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QPushButton, QFileDialog from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py index 545066aa27..c09238807d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import ( diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py index 4eef933419..9c8648418f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QSpinBox diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py index c940acb4f8..9deb3ba6f5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py index 3b689517f4..e98a23fa92 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QFileDialog diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py index 34a652a6fd..904f0cfd91 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import itertools diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py index 161fbee4a9..e68238e768 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import itertools diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py index 37810306b8..1c205b5550 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QRadioButton, QButtonGroup, QLabel, QHBoxLayout from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py index 09f9bb51af..21ad0c2e41 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QComboBox, QLabel, QTableView from qtpy.QtCore import Slot, Signal, Qt diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py index b24032405d..78e4552c25 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py index 6a3de5bc6c..f63acd16fd 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import multiprocessing diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py index 6453b4b2a5..5276ea60d8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtWidgets import QLineEdit from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py index 3f4df5f125..746a5036b5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from abc import abstractmethod diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py index 78668ec938..563d45b1ee 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import glob import importlib diff --git a/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py index 1f4423d5cc..cf0920148b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) """This module contains a RegistryTree data model, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py index 9d83217845..e486bbb2db 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py index c17dfd3197..aef8a8c716 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import sys diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py index b093a0fcac..641ee93abd 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py index 1c53d58c04..f25ff56080 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py index 0ea7913e94..d2f82d1538 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py index a10919405f..c2ef0628cc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) """This module contains a RegistryTree data model, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py index cdb54c164d..54d220f8fd 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from functools import partial from qtpy.QtCore import Slot from qtpy.QtWidgets import QWidget diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py index 25127cf61d..b2c1eeeca2 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtCore import QObject, Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py index a1d238fa79..1f57112eef 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from functools import partial from qtpy.QtCore import Slot from qtpy.QtWidgets import QWidget, QComboBox diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py index aef1a3c106..8ab1cf7f43 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtCore import QObject, Slot, Signal, QMessageLogger, qInstallMessageHandler diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py index dff1428cb3..81168d9949 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from qtpy.QtCore import QObject, Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py index 1fa7d3226e..a9e7d22086 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import os from functools import partial diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py index c5ef024e59..5aca9aa67f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from PyQt6.QtCore import QAbstractItemModel, QObject from qtpy.QtCore import Slot, Signal, QModelIndex, Qt diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py index 520bb3bf4f..998ab73ab9 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) from typing import Union from qtpy.QtCore import Slot, Signal, QModelIndex diff --git a/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py b/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py index 98201aff37..415756ef4c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import copy diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py index 6466823cb0..7c66b1fd35 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py @@ -14,4 +14,3 @@ # along with this program. If not, see . # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) diff --git a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py index 6efe5c550e..b3f5b9cb24 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) import warnings diff --git a/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py b/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py index 2d6f7c2fa7..a8f6185d86 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py @@ -15,7 +15,6 @@ # # Copyright (C) Institut Laue Langevin 2013-now # Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Scientific Computing Group at ILL (see AUTHORS) __description__ = "Graphical User Interface for the MDANSE software" From 88541782bd5b89d2054830d0dd4f85b383681a3c Mon Sep 17 00:00:00 2001 From: Chi Cheng Date: Thu, 28 Mar 2024 11:06:21 +0000 Subject: [PATCH 08/11] removed authors and copyright from headers. removed pkginfo --- MDANSE/Extensions/atomic_trajectory.pyx | 2 - MDANSE/Extensions/atoms_in_shell.pyx | 2 - MDANSE/Extensions/change_coordinates.pyx | 2 - MDANSE/Extensions/com_trajectory.pyx | 2 - MDANSE/Extensions/contiguous_coordinates.pyx | 2 - MDANSE/Extensions/distance_histogram.pyx | 2 - MDANSE/Extensions/fast_calculation.pyx | 2 - MDANSE/Extensions/fold_coordinates.pyx | 2 - MDANSE/Extensions/mic_fast_calc.pyx | 2 - MDANSE/Extensions/mt_fast_calc.pyx | 2 - MDANSE/Extensions/qhull.pyx | 5 +- MDANSE/Extensions/sas_fast_calc.pyx | 2 - MDANSE/Extensions/sd_fast_calc.pyx | 2 - MDANSE/Src/MDANSE/Chemistry/Databases.py | 2 - MDANSE/Src/MDANSE/Core/Error.py | 2 - MDANSE/Src/MDANSE/Core/Platform.py | 2 - MDANSE/Src/MDANSE/Core/Singleton.py | 2 - MDANSE/Src/MDANSE/Core/SubclassFactory.py | 3 - MDANSE/Src/MDANSE/Core/__init__.py | 2 - MDANSE/Src/MDANSE/Extensions/__init__.py | 2 - MDANSE/Src/MDANSE/Framework/Configurable.py | 2 - .../Configurators/ASEFileConfigurator.py | 2 - .../Configurators/AseInputFileConfigurator.py | 2 - .../Configurators/AtomMappingConfigurator.py | 2 - .../AtomSelectionConfigurator.py | 2 - .../AtomTransmutationConfigurator.py | 2 - .../Configurators/AtomsListConfigurator.py | 2 - .../AxisSelectionConfigurator.py | 2 - .../BasisSelectionConfigurator.py | 2 - .../Configurators/BooleanConfigurator.py | 2 - .../Configurators/ConfigFileConfigurator.py | 2 - .../Configurators/FieldFileConfigurator.py | 2 - .../Configurators/FloatConfigurator.py | 2 - .../Configurators/FramesConfigurator.py | 2 - .../GroupingLevelConfigurator.py | 2 - .../Configurators/HDFInputFileConfigurator.py | 2 - .../HDFTrajectoryConfigurator.py | 2 - .../Framework/Configurators/IConfigurator.py | 2 - .../InputDirectoryConfigurator.py | 2 - .../Configurators/InputFileConfigurator.py | 2 - .../InstrumentResolutionConfigurator.py | 2 - .../Configurators/IntegerConfigurator.py | 2 - .../InterpolationOrderConfigurator.py | 2 - .../Configurators/MDFileConfigurator.py | 2 - .../MDMCTrajectoryConfigurator.py | 2 - .../McStasInstrumentConfigurator.py | 2 - .../McStasOptionsConfigurator.py | 2 - .../McStasParametersConfigurator.py | 2 - .../MockTrajectoryConfigurator.py | 2 - .../MultipleChoicesConfigurator.py | 2 - .../OutputDirectoryConfigurator.py | 2 - .../Configurators/OutputFilesConfigurator.py | 2 - .../OutputTrajectoryConfigurator.py | 2 - .../PartialChargeConfigurator.py | 2 - .../Configurators/ProjectionConfigurator.py | 2 - .../Configurators/PythonObjectConfigurator.py | 2 - .../Configurators/PythonScriptConfigurator.py | 2 - .../Configurators/QVectorsConfigurator.py | 2 - .../Configurators/RangeConfigurator.py | 2 - .../Configurators/RunningModeConfigurator.py | 2 - .../Configurators/SingleChoiceConfigurator.py | 2 - .../SingleOutputFileConfigurator.py | 2 - .../Configurators/StringConfigurator.py | 2 - .../TrajectoryVariableConfigurator.py | 2 - .../Configurators/VectorConfigurator.py | 2 - .../Configurators/WeightsConfigurator.py | 2 - .../Configurators/XDATCARFileConfigurator.py | 2 - .../Configurators/XTDFileConfigurator.py | 2 - .../Configurators/XYZFileConfigurator.py | 2 - .../Framework/Configurators/__init__.py | 2 - MDANSE/Src/MDANSE/Framework/Converters/ASE.py | 2 - .../Src/MDANSE/Framework/Converters/CASTEP.py | 2 - .../Src/MDANSE/Framework/Converters/CHARMM.py | 2 - .../Src/MDANSE/Framework/Converters/CP2K.py | 2 - .../MDANSE/Framework/Converters/Converter.py | 2 - MDANSE/Src/MDANSE/Framework/Converters/DCD.py | 2 - .../Src/MDANSE/Framework/Converters/DFTB.py | 2 - .../MDANSE/Framework/Converters/DL_POLY.py | 2 - .../Src/MDANSE/Framework/Converters/DMol.py | 2 - .../MDANSE/Framework/Converters/Discover.py | 2 - .../MDANSE/Framework/Converters/Forcite.py | 2 - .../MDANSE/Framework/Converters/Gromacs.py | 2 - .../Framework/Converters/ImprovedASE.py | 2 - .../Src/MDANSE/Framework/Converters/LAMMPS.py | 2 - .../Src/MDANSE/Framework/Converters/NAMD.py | 2 - .../Src/MDANSE/Framework/Converters/VASP.py | 2 - .../Src/MDANSE/Framework/Converters/XPLOR.py | 2 - .../MDANSE/Framework/Converters/__init__.py | 2 - .../Src/MDANSE/Framework/Formats/HDFFormat.py | 2 - .../Src/MDANSE/Framework/Formats/IFormat.py | 2 - .../Src/MDANSE/Framework/Formats/SVGFormat.py | 2 - .../MDANSE/Framework/Formats/TextFormat.py | 2 - .../Src/MDANSE/Framework/Formats/__init__.py | 2 - .../Handlers/ColorizingStreamHandler.py | 2 - .../Src/MDANSE/Framework/Handlers/IHandler.py | 2 - .../Framework/Handlers/LogfileHandler.py | 2 - .../Src/MDANSE/Framework/Handlers/__init__.py | 2 - .../MDANSE/Framework/InputData/EmptyData.py | 2 - .../InputData/HDFTrajectoryInputData.py | 2 - .../MDANSE/Framework/InputData/IInputData.py | 2 - .../Framework/InputData/InputFileData.py | 2 - .../Framework/InputData/MVITraceInputData.py | 2 - .../InputData/MockTrajectoryInputData.py | 2 - .../InputData/PeriodicTableInputData.py | 2 - .../MDANSE/Framework/InputData/__init__.py | 2 - .../InstrumentResolutions/Gaussian.py | 2 - .../IInstrumentResolution.py | 2 - .../Framework/InstrumentResolutions/Ideal.py | 2 - .../InstrumentResolutions/Lorentzian.py | 2 - .../InstrumentResolutions/PseudoVoigt.py | 2 - .../Framework/InstrumentResolutions/Square.py | 2 - .../InstrumentResolutions/Triangular.py | 2 - .../InstrumentResolutions/__init__.py | 2 - .../Framework/Jobs/AngularCorrelation.py | 2 - .../MDANSE/Framework/Jobs/AreaPerMolecule.py | 2 - .../Jobs/CenterOfMassesTrajectory.py | 2 - .../Framework/Jobs/CoordinationNumber.py | 2 - .../Framework/Jobs/CroppedTrajectory.py | 2 - .../Jobs/CurrentCorrelationFunction.py | 2 - MDANSE/Src/MDANSE/Framework/Jobs/Density.py | 2 - .../MDANSE/Framework/Jobs/DensityOfStates.py | 2 - .../MDANSE/Framework/Jobs/DensityProfile.py | 2 - .../Jobs/DipoleAutoCorrelationFunction.py | 2 - .../Framework/Jobs/DistanceHistogram.py | 2 - .../Jobs/DynamicCoherentStructureFactor.py | 2 - .../Jobs/DynamicIncoherentStructureFactor.py | 2 - .../Src/MDANSE/Framework/Jobs/Eccentricity.py | 2 - .../Jobs/ElasticIncoherentStructureFactor.py | 2 - ...aussianDynamicIncoherentStructureFactor.py | 2 - .../Jobs/GeneralAutoCorrelationFunction.py | 2 - .../Jobs/GlobalMotionFilteredTrajectory.py | 2 - MDANSE/Src/MDANSE/Framework/Jobs/IJob.py | 2 - MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py | 2 - .../Framework/Jobs/McStasVirtualInstrument.py | 2 - .../Framework/Jobs/MeanSquareDisplacement.py | 2 - .../MDANSE/Framework/Jobs/MolecularTrace.py | 2 - .../MDANSE/Framework/Jobs/MoleculeFinder.py | 2 - .../NeutronDynamicTotalStructureFactor.py | 2 - .../MDANSE/Framework/Jobs/OrderParameter.py | 2 - .../Jobs/PairDistributionFunction.py | 2 - .../Jobs/PositionAutoCorrelationFunction.py | 2 - .../MDANSE/Framework/Jobs/RadiusOfGyration.py | 2 - .../Framework/Jobs/RigidBodyTrajectory.py | 2 - .../Framework/Jobs/RootMeanSquareDeviation.py | 2 - .../Jobs/RootMeanSquareFluctuation.py | 2 - .../Jobs/SolventAccessibleSurface.py | 2 - .../Framework/Jobs/StaticStructureFactor.py | 2 - .../StructureFactorFromScatteringFunction.py | 2 - .../Src/MDANSE/Framework/Jobs/Temperature.py | 2 - .../Framework/Jobs/UnfoldedTrajectory.py | 2 - .../Jobs/VelocityAutoCorrelationFunction.py | 2 - MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py | 2 - .../Jobs/XRayStaticStructureFactor.py | 2 - MDANSE/Src/MDANSE/Framework/Jobs/__init__.py | 2 - .../OutputVariables/IOutputVariable.py | 2 - .../OutputVariables/LineOutputVariable.py | 2 - .../OutputVariables/SurfaceOutputVariable.py | 2 - .../OutputVariables/VolumeOutputVariable.py | 2 - .../Framework/OutputVariables/__init__.py | 2 - .../Framework/Projectors/AxialProjector.py | 2 - .../MDANSE/Framework/Projectors/IProjector.py | 2 - .../Framework/Projectors/NullProjector.py | 2 - .../Framework/Projectors/PlanarProjector.py | 2 - .../MDANSE/Framework/Projectors/__init__.py | 2 - .../QVectors/ApproximateDispersionQVectors.py | 2 - .../QVectors/CircularLatticeQVectors.py | 2 - .../Framework/QVectors/CircularQVectors.py | 2 - .../QVectors/DispersionLatticeQVectors.py | 2 - .../MDANSE/Framework/QVectors/GridQVectors.py | 2 - .../MDANSE/Framework/QVectors/IQVectors.py | 2 - .../Framework/QVectors/LatticeQVectors.py | 2 - .../QVectors/LinearLatticeQVectors.py | 2 - .../Framework/QVectors/LinearQVectors.py | 2 - .../QVectors/MillerIndicesQVectors.py | 2 - .../QVectors/SphericalLatticeQVectors.py | 2 - .../Framework/QVectors/SphericalQVectors.py | 2 - .../Src/MDANSE/Framework/QVectors/__init__.py | 2 - .../Framework/Session/CurrentSession.py | 2 - MDANSE/Src/MDANSE/Framework/Status.py | 2 - .../MDANSE/Framework/UserDefinitionStore.py | 2 - MDANSE/Src/MDANSE/Framework/__init__.py | 2 - MDANSE/Src/MDANSE/IO/HDF5.py | 2 - MDANSE/Src/MDANSE/IO/IOUtils.py | 2 - MDANSE/Src/MDANSE/IO/__init__.py | 2 - MDANSE/Src/MDANSE/Mathematics/Arithmetic.py | 2 - MDANSE/Src/MDANSE/Mathematics/Geometry.py | 2 - MDANSE/Src/MDANSE/Mathematics/Graph.py | 2 - MDANSE/Src/MDANSE/Mathematics/Signal.py | 2 - MDANSE/Src/MDANSE/Mathematics/__init__.py | 2 - .../Src/MDANSE/MolecularDynamics/Analysis.py | 2 - .../MDANSE/MolecularDynamics/Connectivity.py | 2 - .../MolecularDynamics/MockTrajectory.py | 1 - .../MDANSE/MolecularDynamics/Trajectory.py | 1 - .../MolecularDynamics/TrajectoryUtils.py | 1 - .../Src/MDANSE/MolecularDynamics/__init__.py | 2 - .../NeutronInstruments/Coverage/Coverage.py | 3 - .../Coverage/TotalCoverage.py | 3 - .../NeutronInstruments/Coverage/__init__.py | 3 - .../NeutronInstruments/IdealInstrument.py | 3 - .../NeutronInstruments/Method/NullMethod.py | 3 - .../Method/ScatteringMethod.py | 3 - .../Method/TOFDiffraction.py | 3 - .../NeutronInstruments/Method/__init__.py | 3 - .../NeutronInstruments/NeutronInstrument.py | 3 - .../Resolution/IdealResolution.py | 3 - .../Resolution/Resolution.py | 3 - .../NeutronInstruments/Resolution/__init__.py | 3 - .../Spectrum/FlatSpectrum.py | 3 - .../NeutronInstruments/Spectrum/Spectrum.py | 3 - .../NeutronInstruments/Spectrum/__init__.py | 3 - .../Src/MDANSE/NeutronInstruments/__init__.py | 3 - MDANSE/Src/MDANSE/Scripts/mdanse.py | 2 - MDANSE/Src/MDANSE/Scripts/mdanse_job.py | 2 - MDANSE/Src/MDANSE/__init__.py | 2 - MDANSE/Src/MDANSE/__pkginfo__.py | 55 ------------------- MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py | 3 - .../MDANSE_GUI/DataViewModel/ActionsHolder.py | 3 - .../Src/MDANSE_GUI/DataViewModel/JobHolder.py | 3 - .../MDANSE_GUI/DataViewModel/JobStatusQt.py | 3 - .../DataViewModel/TrajectoryHolder.py | 3 - .../Src/MDANSE_GUI/DataViewModel/__init__.py | 2 - .../Src/MDANSE_GUI/ElementsDatabaseEditor.py | 3 - MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py | 2 - .../InputWidgets/AseInputFileWidget.py | 2 - .../InputWidgets/AtomMappingWidget.py | 2 - .../InputWidgets/AtomSelectionWidget.py | 2 - .../InputWidgets/AtomTransmutationWidget.py | 2 - .../MDANSE_GUI/InputWidgets/BackupWidget.py | 2 - .../MDANSE_GUI/InputWidgets/BooleanWidget.py | 2 - .../MDANSE_GUI/InputWidgets/ComboWidget.py | 2 - .../MDANSE_GUI/InputWidgets/DummyWidget.py | 2 - .../MDANSE_GUI/InputWidgets/FloatWidget.py | 2 - .../MDANSE_GUI/InputWidgets/FramesWidget.py | 2 - .../InputWidgets/HDFTrajectoryWidget.py | 2 - .../InputWidgets/InputDirectoryWidget.py | 2 - .../InputWidgets/InputFileWidget.py | 2 - .../InstrumentResolutionWidget.py | 2 - .../MDANSE_GUI/InputWidgets/IntegerWidget.py | 2 - .../InputWidgets/InterpolationOrderWidget.py | 2 - .../InputWidgets/OutputDirectoryWidget.py | 2 - .../InputWidgets/OutputFilesWidget.py | 2 - .../InputWidgets/OutputTrajectoryWidget.py | 2 - .../InputWidgets/ProjectionWidget.py | 2 - .../MDANSE_GUI/InputWidgets/QVectorsWidget.py | 2 - .../MDANSE_GUI/InputWidgets/RangeWidget.py | 2 - .../InputWidgets/RunningModeWidget.py | 2 - .../MDANSE_GUI/InputWidgets/StringWidget.py | 2 - .../Src/MDANSE_GUI/InputWidgets/WidgetBase.py | 2 - .../Src/MDANSE_GUI/InputWidgets/__init__.py | 2 - .../MolecularViewer/AtomProperties.py | 2 - .../MolecularViewer/ColourManager.py | 2 - .../MDANSE_GUI/MolecularViewer/Contents.py | 2 - .../MDANSE_GUI/MolecularViewer/Controls.py | 2 - .../Src/MDANSE_GUI/MolecularViewer/Dummy.py | 2 - .../MolecularViewer/MolecularViewer.py | 2 - .../MDANSE_GUI/MolecularViewer/__init__.py | 2 - .../MolecularViewer/database/__init__.py | 2 - .../MolecularViewer/readers/hdf5wrapper.py | 2 - .../MolecularViewer/readers/i_reader.py | 2 - .../readers/reader_registry.py | 2 - .../Src/MDANSE_GUI/PeriodicTableViewer.py | 3 - MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py | 2 - .../Plotter/dialogs/about_dialog.py | 2 - .../Plotter/dialogs/cross_viewer_dialog.py | 2 - .../Plotter/dialogs/data_viewer_1d_dialog.py | 2 - .../Plotter/dialogs/data_viewer_nd_dialog.py | 2 - .../Plotter/dialogs/inspect_data_dialog.py | 2 - .../dialogs/plot_1d_axis_settings_dialog.py | 2 - .../plot_1d_general_settings_dialog.py | 2 - .../dialogs/plot_1d_lines_settings_dialog.py | 2 - .../plot_2d_general_settings_dialog.py | 2 - .../dialogs/plot_2d_image_settings_dialog.py | 2 - .../dialogs/plot_nd_axis_settings_dialog.py | 2 - .../plot_nd_general_settings_dialog.py | 2 - .../dialogs/plot_nd_image_settings_dialog.py | 2 - .../Plotter/dialogs/slice_viewer_dialog.py | 2 - .../Plotter/dialogs/units_editor_dialog.py | 2 - .../Plotter/dialogs/viewer_1d_dialog.py | 2 - .../Plotter/handlers/logger_popup.py | 2 - .../Plotter/handlers/logger_widget.py | 2 - .../Plotter/models/data_list_model.py | 2 - .../Plotter/models/data_tree_model.py | 2 - .../Plotter/models/plot_1d_model.py | 2 - .../Plotter/models/plot_2d_model.py | 2 - .../Plotter/models/plot_nd_model.py | 2 - .../Src/MDANSE_GUI/Plotter/utils/numeric.py | 2 - .../MDANSE_GUI/Plotter/utils/sorted_dict.py | 2 - .../MDANSE_GUI/Plotter/utils/sorted_list.py | 2 - .../MDANSE_GUI/Plotter/utils/sorted_set.py | 2 - .../MDANSE_GUI/Plotter/views/table_views.py | 2 - .../Plotter/widgets/actions_widget.py | 2 - .../MDANSE_GUI/Plotter/widgets/data_widget.py | 2 - .../Plotter/widgets/datasets_widget.py | 2 - .../Plotter/widgets/logger_widget.py | 2 - .../MDANSE_GUI/Plotter/widgets/main_window.py | 2 - .../Plotter/widgets/plot_1d_widget.py | 2 - .../Plotter/widgets/plot_2d_widget.py | 2 - .../Plotter/widgets/plot_actions_widget.py | 2 - .../Plotter/widgets/plot_nd_widget.py | 2 - .../Plotter/widgets/preview_widget.py | 2 - .../Plotter/widgets/range_slider.py | 2 - MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py | 2 - MDANSE_GUI/Src/MDANSE_GUI/Resources.py | 3 - .../Scripts/mdanse_elements_database.py | 2 - .../Src/MDANSE_GUI/Scripts/mdanse_gui.py | 2 - .../Scripts/mdanse_periodic_table.py | 2 - .../Src/MDANSE_GUI/Scripts/mdanse_plotter.py | 2 - .../MDANSE_GUI/Scripts/mdanse_units_editor.py | 2 - MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py | 2 - .../MDANSE_GUI/Subprocess/JobStatusProcess.py | 3 - .../Src/MDANSE_GUI/Subprocess/Subprocess.py | 3 - MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py | 3 - .../Src/MDANSE_GUI/Tabs/ConverterTab.py | 2 - MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py | 2 - MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py | 2 - .../MDANSE_GUI/Tabs/Layouts/DoublePanel.py | 3 - .../MDANSE_GUI/Tabs/Layouts/SinglePanel.py | 3 - .../MDANSE_GUI/Tabs/Layouts/TriplePanel.py | 3 - MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py | 2 - .../Src/MDANSE_GUI/Tabs/Models/JobHolder.py | 3 - MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py | 2 - .../Src/MDANSE_GUI/Tabs/TrajectoryTab.py | 2 - .../Src/MDANSE_GUI/Tabs/Views/ActionsTree.py | 3 - .../Src/MDANSE_GUI/Tabs/Views/RunTable.py | 2 - .../MDANSE_GUI/Tabs/Views/TrajectoryView.py | 2 - .../Src/MDANSE_GUI/Tabs/Visualisers/Action.py | 3 - MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py | 2 - .../Src/MDANSE_GUI/Widgets/ConvertDialog.py | 3 - .../Src/MDANSE_GUI/Widgets/ConvertWizard.py | 3 - .../Src/MDANSE_GUI/Widgets/GeneralWidgets.py | 3 - .../Src/MDANSE_GUI/Widgets/Generator.py | 3 - .../Src/MDANSE_GUI/Widgets/LoaderButton.py | 3 - .../Src/MDANSE_GUI/Widgets/Oscillator.py | 3 - .../Src/MDANSE_GUI/Widgets/StyleDialog.py | 3 - .../MDANSE_GUI/Widgets/TrajectoryViewer.py | 3 - MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py | 2 - MDANSE_GUI/Src/MDANSE_GUI/__init__.py | 2 - MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py | 51 ----------------- MDANSE_GUI/Src/MDANSE_GUI/main.py | 3 - 339 files changed, 1 insertion(+), 822 deletions(-) delete mode 100644 MDANSE/Src/MDANSE/__pkginfo__.py delete mode 100644 MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py diff --git a/MDANSE/Extensions/atomic_trajectory.pyx b/MDANSE/Extensions/atomic_trajectory.pyx index 3405c90488..b8ac8c1ffc 100644 --- a/MDANSE/Extensions/atomic_trajectory.pyx +++ b/MDANSE/Extensions/atomic_trajectory.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython import numpy as np diff --git a/MDANSE/Extensions/atoms_in_shell.pyx b/MDANSE/Extensions/atoms_in_shell.pyx index 8f1f395dfd..126987314d 100644 --- a/MDANSE/Extensions/atoms_in_shell.pyx +++ b/MDANSE/Extensions/atoms_in_shell.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython import numpy as np diff --git a/MDANSE/Extensions/change_coordinates.pyx b/MDANSE/Extensions/change_coordinates.pyx index 5efd3edd0e..14a5bc8b97 100644 --- a/MDANSE/Extensions/change_coordinates.pyx +++ b/MDANSE/Extensions/change_coordinates.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython import numpy as np diff --git a/MDANSE/Extensions/com_trajectory.pyx b/MDANSE/Extensions/com_trajectory.pyx index 3f3e4b191a..54a8182d4a 100644 --- a/MDANSE/Extensions/com_trajectory.pyx +++ b/MDANSE/Extensions/com_trajectory.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import sys diff --git a/MDANSE/Extensions/contiguous_coordinates.pyx b/MDANSE/Extensions/contiguous_coordinates.pyx index 92a1d21f33..92bb9aa539 100644 --- a/MDANSE/Extensions/contiguous_coordinates.pyx +++ b/MDANSE/Extensions/contiguous_coordinates.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import sys diff --git a/MDANSE/Extensions/distance_histogram.pyx b/MDANSE/Extensions/distance_histogram.pyx index 53acdbb7e8..73254b435e 100644 --- a/MDANSE/Extensions/distance_histogram.pyx +++ b/MDANSE/Extensions/distance_histogram.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython cimport numpy as np diff --git a/MDANSE/Extensions/fast_calculation.pyx b/MDANSE/Extensions/fast_calculation.pyx index accf2f5236..4933c57643 100644 --- a/MDANSE/Extensions/fast_calculation.pyx +++ b/MDANSE/Extensions/fast_calculation.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython import numpy as np diff --git a/MDANSE/Extensions/fold_coordinates.pyx b/MDANSE/Extensions/fold_coordinates.pyx index 9edaab1e2a..069cfb18dc 100644 --- a/MDANSE/Extensions/fold_coordinates.pyx +++ b/MDANSE/Extensions/fold_coordinates.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython import numpy as np diff --git a/MDANSE/Extensions/mic_fast_calc.pyx b/MDANSE/Extensions/mic_fast_calc.pyx index 0737cbd55e..3a1555074e 100644 --- a/MDANSE/Extensions/mic_fast_calc.pyx +++ b/MDANSE/Extensions/mic_fast_calc.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now cimport numpy as np import numpy as np diff --git a/MDANSE/Extensions/mt_fast_calc.pyx b/MDANSE/Extensions/mt_fast_calc.pyx index 499dbed930..d5a7de4c05 100644 --- a/MDANSE/Extensions/mt_fast_calc.pyx +++ b/MDANSE/Extensions/mt_fast_calc.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython cimport numpy as np diff --git a/MDANSE/Extensions/qhull.pyx b/MDANSE/Extensions/qhull.pyx index b72b6c25f0..a70213862d 100644 --- a/MDANSE/Extensions/qhull.pyx +++ b/MDANSE/Extensions/qhull.pyx @@ -14,10 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Copyright (C) Pauli Virtanen, 2010. -# + # Copyright (C) Pauli Virtanen, 2010. # # Distributed under the same BSD license as Scipy. diff --git a/MDANSE/Extensions/sas_fast_calc.pyx b/MDANSE/Extensions/sas_fast_calc.pyx index 5e4aa11c13..88cfdebfc5 100644 --- a/MDANSE/Extensions/sas_fast_calc.pyx +++ b/MDANSE/Extensions/sas_fast_calc.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython import numpy as np diff --git a/MDANSE/Extensions/sd_fast_calc.pyx b/MDANSE/Extensions/sd_fast_calc.pyx index 11b6cc701c..82af1348fb 100644 --- a/MDANSE/Extensions/sd_fast_calc.pyx +++ b/MDANSE/Extensions/sd_fast_calc.pyx @@ -14,8 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import cython cimport numpy as np diff --git a/MDANSE/Src/MDANSE/Chemistry/Databases.py b/MDANSE/Src/MDANSE/Chemistry/Databases.py index 48a7349ec1..b5d89846f1 100644 --- a/MDANSE/Src/MDANSE/Chemistry/Databases.py +++ b/MDANSE/Src/MDANSE/Chemistry/Databases.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import copy import os diff --git a/MDANSE/Src/MDANSE/Core/Error.py b/MDANSE/Src/MDANSE/Core/Error.py index 07b964247b..a36e2c3027 100644 --- a/MDANSE/Src/MDANSE/Core/Error.py +++ b/MDANSE/Src/MDANSE/Core/Error.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now class Error(Exception): diff --git a/MDANSE/Src/MDANSE/Core/Platform.py b/MDANSE/Src/MDANSE/Core/Platform.py index 47a14fce2b..3695241bc8 100644 --- a/MDANSE/Src/MDANSE/Core/Platform.py +++ b/MDANSE/Src/MDANSE/Core/Platform.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import abc import ctypes diff --git a/MDANSE/Src/MDANSE/Core/Singleton.py b/MDANSE/Src/MDANSE/Core/Singleton.py index 0a62ea343e..01154c5a51 100644 --- a/MDANSE/Src/MDANSE/Core/Singleton.py +++ b/MDANSE/Src/MDANSE/Core/Singleton.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now class Singleton(type): diff --git a/MDANSE/Src/MDANSE/Core/SubclassFactory.py b/MDANSE/Src/MDANSE/Core/SubclassFactory.py index 098af14d43..39de5a6d31 100644 --- a/MDANSE/Src/MDANSE/Core/SubclassFactory.py +++ b/MDANSE/Src/MDANSE/Core/SubclassFactory.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from typing import TypeVar import difflib diff --git a/MDANSE/Src/MDANSE/Core/__init__.py b/MDANSE/Src/MDANSE/Core/__init__.py index 8babc2272a..268c9cc94f 100644 --- a/MDANSE/Src/MDANSE/Core/__init__.py +++ b/MDANSE/Src/MDANSE/Core/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now diff --git a/MDANSE/Src/MDANSE/Extensions/__init__.py b/MDANSE/Src/MDANSE/Extensions/__init__.py index 8babc2272a..268c9cc94f 100644 --- a/MDANSE/Src/MDANSE/Extensions/__init__.py +++ b/MDANSE/Src/MDANSE/Extensions/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now diff --git a/MDANSE/Src/MDANSE/Framework/Configurable.py b/MDANSE/Src/MDANSE/Framework/Configurable.py index cdc4302739..7ec5fc40f8 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurable.py +++ b/MDANSE/Src/MDANSE/Framework/Configurable.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py index 21fde5745f..3f34a20502 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ASEFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from ase.io import iread, read from ase.io.trajectory import Trajectory as ASETrajectory diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py index 22d64f2c06..7d1dfce11b 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AseInputFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py index 9651391957..f49c583c62 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomMappingConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import json from MDANSE.Framework.AtomMapping import fill_remaining_labels, check_mapping_valid diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py index 95cbe38b0a..7d1f2b73df 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomSelectionConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import operator from MDANSE.Chemistry import ATOMS_DATABASE from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py index 40f2dd9f56..d391ea542e 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Chemistry import ATOMS_DATABASE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py index 85e6d302e1..a38e03d37e 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AtomsListConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.UserDefinitionStore import UD_STORE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py index 2343d38d37..02e31a535d 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/AxisSelectionConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.UserDefinitionStore import UD_STORE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py index 79b5ca997f..c4ed8b6755 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/BasisSelectionConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.UserDefinitionStore import UD_STORE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py index fff73a4503..f536b5ee0c 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/BooleanConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py index 708bc82c71..5e864b0597 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ConfigFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py index 7f38c9abd7..4c81054564 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FieldFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import re from MDANSE.Chemistry.ChemicalEntity import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py index bf951edb94..591c457192 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FloatConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py index 20eff0d4f3..30c0daedf7 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/FramesConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py index c4b8a69830..6c699b8443 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/GroupingLevelConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py index 2778c64659..339fda7037 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/HDFInputFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import h5py diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py index 59781bbf56..17e798dbae 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/HDFTrajectoryConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py index 8f6aae384b..41a057b780 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/IConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import abc diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py index 819bbdab75..b74a74200d 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InputDirectoryConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py index 7a50c982e0..d47387ad72 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InputFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py index e9724a7a7b..55086c1738 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InstrumentResolutionConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py index e96d84a51f..d8ca56bb11 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/IntegerConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py index 1c1ee82ea0..32fdbd8cd8 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/InterpolationOrderConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py index 0c624c8d3a..d81174c230 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MDFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import itertools import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py index 14d3586a95..eaf15cd98f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MDMCTrajectoryConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py index 9ba847a93b..9197d39253 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasInstrumentConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.InputFileConfigurator import InputFileConfigurator diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py index 1c3456167b..8696a1217f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasOptionsConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os import tempfile diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py index b3446ee03b..f778ba47ed 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/McStasParametersConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os import re diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py index 5bbe400d94..7b50f17173 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MockTrajectoryConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py index b0f9e9af3d..f4a98007ad 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/MultipleChoicesConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py index e04992807b..f6ad5831d5 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputDirectoryConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py index a4382ed31c..548ee9a577 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputFilesConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os import tempfile diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py index b0a9ba3334..1ea997c495 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/OutputTrajectoryConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py index c6a845683c..71a27e0e4f 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PartialChargeConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py index af632710e0..32dbc7ae74 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/ProjectionConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py index 3968a5c2da..802933bd6a 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PythonObjectConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import ast diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py index a1b4010cc6..1886a0c9eb 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/PythonScriptConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ConfiguratorError diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py index 9071de60c7..a27da46e2a 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/QVectorsConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.UserDefinitionStore import UD_STORE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py index 72e0c62308..c3a73eb034 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/RangeConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py index b9e7e28813..cfa2bdfff4 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/RunningModeConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os import multiprocessing diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py index 496930d650..85a0420cc4 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/SingleChoiceConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py index 1b4fc5dd48..9027bdd1f4 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/SingleOutputFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os from MDANSE import PLATFORM from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py index 3bf8e75b76..fa496fa39e 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/StringConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import ast diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py index 767911b689..9df595aea5 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/TrajectoryVariableConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Configurators.IConfigurator import ( diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py index 824216de4f..9cf198d763 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/VectorConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py index 7450002c83..c4ae20e678 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/WeightsConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Chemistry import ATOMS_DATABASE diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py index ed89b3e88b..bb16c4e1aa 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XDATCARFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py index e6e82e9b86..a78e59dfb7 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XTDFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import xml.etree.ElementTree as ElementTree diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py b/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py index ac364869c8..b56452f7c2 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/XYZFileConfigurator.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import re import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py b/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py index 689c5f64c7..e36d77d78c 100644 --- a/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Configurators/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/ASE.py b/MDANSE/Src/MDANSE/Framework/Converters/ASE.py index e1524a8b91..747e4843df 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/ASE.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/ASE.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py b/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py index 26329d7eab..d5f20317a4 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections from MDANSE.Chemistry.ChemicalEntity import Atom, ChemicalSystem diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py b/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py index a0333b635e..ad11613935 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CHARMM.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py b/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py index 79069eb95b..1727b1da80 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/CP2K.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Converter.py b/MDANSE/Src/MDANSE/Framework/Converters/Converter.py index 8256cf46f2..ab871e395e 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Converter.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Converter.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from abc import ABCMeta, abstractmethod, abstractclassmethod diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DCD.py b/MDANSE/Src/MDANSE/Framework/Converters/DCD.py index f5acc8be18..a89e4ea439 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DCD.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DCD.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py b/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py index a8de91ee55..9471e05036 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DFTB.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py b/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py index 07edf5a96c..f94ad3b375 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DL_POLY.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/DMol.py b/MDANSE/Src/MDANSE/Framework/Converters/DMol.py index 437b8c9158..b37c4c0975 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/DMol.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/DMol.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Converters.Discover import Discover diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Discover.py b/MDANSE/Src/MDANSE/Framework/Converters/Discover.py index 781ba59cab..69e9f364ce 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Discover.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Discover.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import struct import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py b/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py index 2b004d4486..fa4d7195f4 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Forcite.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import struct diff --git a/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py b/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py index 03416807a7..02bdbafeed 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/Gromacs.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py b/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py index d7bc942d21..cff9281310 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/ImprovedASE.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py b/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py index 200f367010..da37dde7a6 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/LAMMPS.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py b/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py index bcb3e6ef5d..3a0c580e5d 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/NAMD.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Converters.Converter import Converter from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/VASP.py b/MDANSE/Src/MDANSE/Framework/Converters/VASP.py index caecc9ef4e..856ad28259 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/VASP.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/VASP.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py b/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py index 068c80a400..fed95cadb6 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/XPLOR.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Converters.DCD import DCD diff --git a/MDANSE/Src/MDANSE/Framework/Converters/__init__.py b/MDANSE/Src/MDANSE/Framework/Converters/__init__.py index 883819ca70..a3e0342bd1 100644 --- a/MDANSE/Src/MDANSE/Framework/Converters/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Converters/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py index dd19a7b928..9d71297a7c 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/HDFFormat.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os import h5py from MDANSE.Framework.Formats.IFormat import IFormat diff --git a/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py index 692a032edd..f85ed93f23 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/IFormat.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py index a7d38066c6..6b2a187615 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/SVGFormat.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os import re diff --git a/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py b/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py index 97eda64d1e..373d73bd59 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os import io diff --git a/MDANSE/Src/MDANSE/Framework/Formats/__init__.py b/MDANSE/Src/MDANSE/Framework/Formats/__init__.py index c8ab035944..7739e3979c 100644 --- a/MDANSE/Src/MDANSE/Framework/Formats/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Formats/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py index bada9842b4..237bc46c31 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/ColorizingStreamHandler.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import ctypes import logging diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py index 5a13da1793..ddea936798 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/IHandler.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py b/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py index 38d0c4ea16..922fc054a8 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/LogfileHandler.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import logging.handlers diff --git a/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py b/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py index f1f1f48adc..68d24466c0 100644 --- a/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Handlers/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py b/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py index f98c146d14..3f2b3d3166 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/EmptyData.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.InputData.IInputData import IInputData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py index f6e6501628..95f9c7a1f4 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/HDFTrajectoryInputData.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.InputData.IInputData import InputDataError diff --git a/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py index e883ab8f17..9df84b8f03 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/IInputData.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py b/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py index 927953c30b..132978c99e 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/InputFileData.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import abc import os diff --git a/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py index ace9f054a3..d7a0e669c9 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/MVITraceInputData.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.InputData.InputFileData import InputFileData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py index 1a3cb7b1d6..b4faa94f49 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/MockTrajectoryInputData.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.InputData.IInputData import InputDataError from MDANSE.Framework.InputData.InputFileData import InputFileData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py b/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py index 0b8b32a12b..5c69833245 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/PeriodicTableInputData.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.InputData.IInputData import IInputData diff --git a/MDANSE/Src/MDANSE/Framework/InputData/__init__.py b/MDANSE/Src/MDANSE/Framework/InputData/__init__.py index 6718b52fec..b97a9c724f 100644 --- a/MDANSE/Src/MDANSE/Framework/InputData/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/InputData/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py index e2502453f1..d64a6d8ed1 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Gaussian.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py index 388b67aae4..31f7b40fc9 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/IInstrumentResolution.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import abc diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py index 0c373d9747..89b1ad985d 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Ideal.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py index a22011034d..b35bf2bc4b 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Lorentzian.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py index a90754f78d..861654dad7 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/PseudoVoigt.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py index 7b4a3b3122..8ba53de8fd 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Square.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py index cb659b1057..3847961d25 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/Triangular.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py index ca0852c20e..0003dbb3b2 100644 --- a/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/InstrumentResolutions/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py b/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py index 7fba5bb54a..5e77513626 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/AngularCorrelation.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py b/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py index c43e0ef074..9def8dfa99 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/AreaPerMolecule.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py index 4cda1945f6..8214c344b6 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CenterOfMassesTrajectory.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py b/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py index c00e61a755..a06197fc79 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CoordinationNumber.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py index eb4c0d63f5..766d149743 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CroppedTrajectory.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py index bab2ec07e4..50a4d10a82 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/CurrentCorrelationFunction.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Density.py b/MDANSE/Src/MDANSE/Framework/Jobs/Density.py index ae6f54a9b4..be2d3dfae1 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Density.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Density.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py b/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py index 4f12a8f6d4..2a5cb5ad24 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DensityOfStates.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py b/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py index 0e66746b13..ce0bc3e3a4 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DensityProfile.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py index 906b492347..fa92494eb3 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DipoleAutoCorrelationFunction.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py b/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py index 72f9ad08e7..49d7a9d767 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DistanceHistogram.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py index aa6689f033..7d0994268e 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicCoherentStructureFactor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py index d6c2dce76d..d7fba9fd19 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/DynamicIncoherentStructureFactor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py b/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py index d5a6d85073..87ceaee15c 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Eccentricity.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py index ab23466e08..8c209f1451 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/ElasticIncoherentStructureFactor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py index f9f2fcd643..e800cddeb4 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GaussianDynamicIncoherentStructureFactor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py index 17d119e9b9..6a97db2a26 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GeneralAutoCorrelationFunction.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py index 569e3d5e0e..056af199ae 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/GlobalMotionFilteredTrajectory.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import copy diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py b/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py index 586bdc4998..86421ca41e 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/IJob.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import abc import glob diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py b/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py index 8c457d59b8..e9c70311e5 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/JobStatus.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import pickle diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py b/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py index f99b29e7d1..c2c3f2b155 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/McStasVirtualInstrument.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py b/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py index de5a3aac6a..8c068e8c80 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MeanSquareDisplacement.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py b/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py index 0f7874c51a..98a38107a8 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MolecularTrace.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py b/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py index 2086c1c5ff..53b7ef4e54 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/MoleculeFinder.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py index b0023f14d0..4160389ed5 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/NeutronDynamicTotalStructureFactor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py b/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py index 52c000d1e9..778236ff5d 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/OrderParameter.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py index 362664c80f..3e036e4631 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/PairDistributionFunction.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py index df2c4fbd7e..d333fd1912 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/PositionAutoCorrelationFunction.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py b/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py index f0eb33bd8d..fd961c7db7 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RadiusOfGyration.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py index f7b6d8988f..18ae060c4d 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RigidBodyTrajectory.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py index 4fc4f1db50..97f2395eac 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareDeviation.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py index f84941451d..78b1956046 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/RootMeanSquareFluctuation.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py b/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py index 45b7d34f23..1dcd7c7e0f 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/SolventAccessibleSurface.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py index 4240cd5504..c3e02e1939 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/StaticStructureFactor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py index 75f6a1e0bb..cd3da49b1c 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/StructureFactorFromScatteringFunction.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import os diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py b/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py index 610998f0f5..7c5894ea34 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Temperature.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py b/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py index ba0f3c57e6..6d21339378 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/UnfoldedTrajectory.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py b/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py index 6a68bc0e62..86f641fcca 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/VelocityAutoCorrelationFunction.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py b/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py index faea30ab66..19051ff29e 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/Voronoi.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import math diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py b/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py index 8f646d251f..9735e32a06 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/XRayStaticStructureFactor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py b/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py index 3dcc89b46b..a991144d96 100644 --- a/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Jobs/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py index c28993a247..e3da83f063 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/IOutputVariable.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py index b21306cc92..a7534196f8 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/LineOutputVariable.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py index 8f8308ab3e..1a335ec5cc 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/SurfaceOutputVariable.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py index c6d96494f2..92c600ead5 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/VolumeOutputVariable.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.OutputVariables.IOutputVariable import IOutputVariable diff --git a/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py b/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py index 432237a4ea..c0eab43316 100644 --- a/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/OutputVariables/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py index 79bc0a076d..c355d07569 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/AxialProjector.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py index feaa81030e..052acd75e5 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/IProjector.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Core.Error import Error diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py index 7def2e2086..33da575be3 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/NullProjector.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from MDANSE.Framework.Projectors.IProjector import IProjector diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py b/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py index ede6c0332e..ff032be388 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/PlanarProjector.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py b/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py index 8a1396c56f..f057eb2ad6 100644 --- a/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/Projectors/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py index 5ff149e643..939f248c56 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/ApproximateDispersionQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py index 452363b4a4..01175ad326 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/CircularLatticeQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import random diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py index 399d7a6c39..b8a2b25a7e 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/CircularQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py index 71bb24e977..ef4cc82071 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/DispersionLatticeQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py index 56fa4a8fef..3e4e4ee873 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/GridQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import itertools diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py index ef4b940c71..0345f59d23 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/IQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import abc diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py index 94e7304338..2a4da68fe1 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LatticeQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py index 6bde09b990..fefabc3aa3 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LinearLatticeQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import random diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py index 7a7b123ba1..26c55932a1 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/LinearQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py index 4cee2a6423..6b3de3a4df 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/MillerIndicesQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py index 8194804adf..566170635a 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalLatticeQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections import random diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py index 4d823d5bb8..d111e4072a 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/SphericalQVectors.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py b/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py index a2622f0437..8ca3a8bf2e 100644 --- a/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/QVectors/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib import os diff --git a/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py b/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py index a8fb047254..f757a61117 100644 --- a/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py +++ b/MDANSE/Src/MDANSE/Framework/Session/CurrentSession.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os from os.path import expanduser diff --git a/MDANSE/Src/MDANSE/Framework/Status.py b/MDANSE/Src/MDANSE/Framework/Status.py index 24f3b9d1c9..46568971a2 100644 --- a/MDANSE/Src/MDANSE/Framework/Status.py +++ b/MDANSE/Src/MDANSE/Framework/Status.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import abc diff --git a/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py b/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py index 0b1c79f2eb..8c2226244e 100644 --- a/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py +++ b/MDANSE/Src/MDANSE/Framework/UserDefinitionStore.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import pickle import os diff --git a/MDANSE/Src/MDANSE/Framework/__init__.py b/MDANSE/Src/MDANSE/Framework/__init__.py index 8babc2272a..268c9cc94f 100644 --- a/MDANSE/Src/MDANSE/Framework/__init__.py +++ b/MDANSE/Src/MDANSE/Framework/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now diff --git a/MDANSE/Src/MDANSE/IO/HDF5.py b/MDANSE/Src/MDANSE/IO/HDF5.py index 1c069925f9..28f0a06852 100644 --- a/MDANSE/Src/MDANSE/IO/HDF5.py +++ b/MDANSE/Src/MDANSE/IO/HDF5.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import h5py import numpy as np diff --git a/MDANSE/Src/MDANSE/IO/IOUtils.py b/MDANSE/Src/MDANSE/IO/IOUtils.py index 936bfb2480..c09fa34e98 100644 --- a/MDANSE/Src/MDANSE/IO/IOUtils.py +++ b/MDANSE/Src/MDANSE/IO/IOUtils.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import abc from collections import OrderedDict diff --git a/MDANSE/Src/MDANSE/IO/__init__.py b/MDANSE/Src/MDANSE/IO/__init__.py index 8babc2272a..268c9cc94f 100644 --- a/MDANSE/Src/MDANSE/IO/__init__.py +++ b/MDANSE/Src/MDANSE/IO/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now diff --git a/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py b/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py index f50afa42fc..f7a46bbd06 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py +++ b/MDANSE/Src/MDANSE/Mathematics/Arithmetic.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import math import cmath diff --git a/MDANSE/Src/MDANSE/Mathematics/Geometry.py b/MDANSE/Src/MDANSE/Mathematics/Geometry.py index 9c9e715a66..60639fc9b4 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Geometry.py +++ b/MDANSE/Src/MDANSE/Mathematics/Geometry.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np from numpy.linalg import det diff --git a/MDANSE/Src/MDANSE/Mathematics/Graph.py b/MDANSE/Src/MDANSE/Mathematics/Graph.py index ec14bb56cf..3f69613584 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Graph.py +++ b/MDANSE/Src/MDANSE/Mathematics/Graph.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import collections diff --git a/MDANSE/Src/MDANSE/Mathematics/Signal.py b/MDANSE/Src/MDANSE/Mathematics/Signal.py index f3344dd308..6b0d7261cc 100644 --- a/MDANSE/Src/MDANSE/Mathematics/Signal.py +++ b/MDANSE/Src/MDANSE/Mathematics/Signal.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np diff --git a/MDANSE/Src/MDANSE/Mathematics/__init__.py b/MDANSE/Src/MDANSE/Mathematics/__init__.py index 8babc2272a..268c9cc94f 100644 --- a/MDANSE/Src/MDANSE/Mathematics/__init__.py +++ b/MDANSE/Src/MDANSE/Mathematics/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py b/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py index f2f85301b2..efedad0a02 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Analysis.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import numpy as np from numpy.typing import NDArray diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Connectivity.py b/MDANSE/Src/MDANSE/MolecularDynamics/Connectivity.py index 2469c0cd95..5728f575de 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Connectivity.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Connectivity.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Maciej Bartkowiak from itertools import product from typing import List, Dict diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py b/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py index c45e4f4958..75e122662c 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/MockTrajectory.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now import math import json diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py b/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py index a11f8f2588..d7e110965f 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/Trajectory.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now from ast import operator import os diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py b/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py index ea3414ea2d..2ad05dec07 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/TrajectoryUtils.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now import operator from typing import Union, Iterable diff --git a/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py b/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py index 8babc2272a..268c9cc94f 100644 --- a/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py +++ b/MDANSE/Src/MDANSE/MolecularDynamics/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/Coverage.py b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/Coverage.py index 890a713c63..b887552f3d 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/Coverage.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/Coverage.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/TotalCoverage.py b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/TotalCoverage.py index 8f2b1849a5..747bb51cf7 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/TotalCoverage.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/TotalCoverage.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.Coverage.Coverage import Coverage diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/__init__.py index f3a898a852..4caf3ac941 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Coverage/__init__.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) """Instrument coverage will be expressed as angular coverage of detectors. By specifying the angle coverage of detector panels, diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/IdealInstrument.py b/MDANSE/Src/MDANSE/NeutronInstruments/IdealInstrument.py index 17ef7be27c..bd9a697fec 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/IdealInstrument.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/IdealInstrument.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.NeutronInstrument import NeutronInstrument from MDANSE.NeutronInstruments.Coverage.Coverage import Coverage diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Method/NullMethod.py b/MDANSE/Src/MDANSE/NeutronInstruments/Method/NullMethod.py index 9a99bb12ea..3ce6938716 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Method/NullMethod.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Method/NullMethod.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.Method.ScatteringMethod import ScatteringMethod diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Method/ScatteringMethod.py b/MDANSE/Src/MDANSE/NeutronInstruments/Method/ScatteringMethod.py index d7276b85dd..b2bd25ea88 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Method/ScatteringMethod.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Method/ScatteringMethod.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Method/TOFDiffraction.py b/MDANSE/Src/MDANSE/NeutronInstruments/Method/TOFDiffraction.py index a901106d70..54de932628 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Method/TOFDiffraction.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Method/TOFDiffraction.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.Method.ScatteringMethod import ScatteringMethod diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Method/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/Method/__init__.py index c4872fee4f..b326884607 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Method/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Method/__init__.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) """An implementation of the Strategy pattern, the Scattering Method will take the instrument parameters, and calculate the weights and diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/NeutronInstrument.py b/MDANSE/Src/MDANSE/NeutronInstruments/NeutronInstrument.py index ed0737cdaa..5f51eae5a9 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/NeutronInstrument.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/NeutronInstrument.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/IdealResolution.py b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/IdealResolution.py index 6e9f5779b9..1419820c68 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/IdealResolution.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/IdealResolution.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) import numpy as np diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/Resolution.py b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/Resolution.py index df26567603..203ed37793 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/Resolution.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/Resolution.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/__init__.py index dca7225518..b7b0c32c4a 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Resolution/__init__.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) """The greatest challenge so far in the realistic neutron instrument implementation, the resolution calculation, will be different for diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/FlatSpectrum.py b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/FlatSpectrum.py index 5b1426e018..1061e5bc9b 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/FlatSpectrum.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/FlatSpectrum.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.NeutronInstruments.Spectrum.Spectrum import Spectrum diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/Spectrum.py b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/Spectrum.py index 807b2e8558..0368309017 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/Spectrum.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/Spectrum.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) from MDANSE.Core.SubclassFactory import SubclassFactory diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/__init__.py index a99e3bbd3b..a80b96f6a0 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/Spectrum/__init__.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) """The number of neutrons arriving at the sample in a unit of time will be, necessarily, wavelength-dependent. While on a direct TOF diff --git a/MDANSE/Src/MDANSE/NeutronInstruments/__init__.py b/MDANSE/Src/MDANSE/NeutronInstruments/__init__.py index c4d171386c..5db818526e 100644 --- a/MDANSE/Src/MDANSE/NeutronInstruments/__init__.py +++ b/MDANSE/Src/MDANSE/NeutronInstruments/__init__.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: RSE Group at ISIS (see AUTHORS) """A new part of the MDANSE code, created in November 2023, the NeutronInstrument section will apply realistic constraints diff --git a/MDANSE/Src/MDANSE/Scripts/mdanse.py b/MDANSE/Src/MDANSE/Scripts/mdanse.py index 8ad305d70a..0baf11aa41 100644 --- a/MDANSE/Src/MDANSE/Scripts/mdanse.py +++ b/MDANSE/Src/MDANSE/Scripts/mdanse.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import pickle import glob diff --git a/MDANSE/Src/MDANSE/Scripts/mdanse_job.py b/MDANSE/Src/MDANSE/Scripts/mdanse_job.py index 687294cc11..70b9aeeec5 100644 --- a/MDANSE/Src/MDANSE/Scripts/mdanse_job.py +++ b/MDANSE/Src/MDANSE/Scripts/mdanse_job.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import argparse import sys diff --git a/MDANSE/Src/MDANSE/__init__.py b/MDANSE/Src/MDANSE/__init__.py index 305d0f9704..fd28887a6f 100644 --- a/MDANSE/Src/MDANSE/__init__.py +++ b/MDANSE/Src/MDANSE/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import warnings diff --git a/MDANSE/Src/MDANSE/__pkginfo__.py b/MDANSE/Src/MDANSE/__pkginfo__.py deleted file mode 100644 index 173efefd97..0000000000 --- a/MDANSE/Src/MDANSE/__pkginfo__.py +++ /dev/null @@ -1,55 +0,0 @@ -# This file is part of MDANSE. -# -# MDANSE is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now - -__description__ = "Analysis of Molecular Dynamics trajectories" - -__long_description__ = """MDANSE is an interactive program for the analysis of Molecular -Dynamics simulations. It is especially designed for the computation -and decomposition of neutron scattering spectra. The structure and -dynamics of the simulated systems can be characterized in terms of -various space and time correlation functions. To analyze the dynamics -of complex systems, rigid-body motions of arbitrarily chosen molecular -subunits can be studied. -""" - -__author__ = "R. Perenon, E.C. Pellegrini, S. Mukhopadhyay, R. Turanyi" - -__author_email__ = ( - "perenon@ill.fr, pellegrini@ill.fr, sanghamitra.mukhopadhyay@stfc.ac.uk, " - "rastislav.turanyi@stfc.ac.uk" -) - -__maintainer__ = "R. Perenon, S. Mukhopadhyay" - -__maintainer_email__ = "perenon@ill.fr, sanghamitra.mukhopadhyay@stfc.ac.uk" - -__former_contributors__ = "G. Goret, B. Aoun, E.C. Pellegrini" - -__url__ = "https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx" - -__repo__ = "https://github.com/ISISNeutronMuon/MDANSE" - -__license__ = "GPL 3" - -__version__ = "2.0.0" - -__date__ = "01-01-1970" - -__commit__ = "undefined" - -__beta__ = "beta" diff --git a/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py b/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py index 14082c9165..22d34456d1 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) import copy from icecream import ic diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/ActionsHolder.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/ActionsHolder.py index c881dd1e6f..949ad43f8e 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/ActionsHolder.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/ActionsHolder.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) import typing diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobHolder.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobHolder.py index f609de848d..2ad15e2d8d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobHolder.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobHolder.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from icecream import ic diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobStatusQt.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobStatusQt.py index ddcfe95ad4..e5bd29d949 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobStatusQt.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/JobStatusQt.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from icecream import ic from qtpy.QtCore import QObject, Slot, Signal, QProcess, QThread, QMutex diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/TrajectoryHolder.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/TrajectoryHolder.py index bf0670ecec..14d98c0a54 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/TrajectoryHolder.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/TrajectoryHolder.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) import hashlib import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py index c440bd180d..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/DataViewModel/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now diff --git a/MDANSE_GUI/Src/MDANSE_GUI/ElementsDatabaseEditor.py b/MDANSE_GUI/Src/MDANSE_GUI/ElementsDatabaseEditor.py index 3fc29b7f21..bc4ef2172d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/ElementsDatabaseEditor.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/ElementsDatabaseEditor.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtWidgets import ( QDialog, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py index 62596886f8..9fd086de59 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Icons/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py index c80f918291..f694143c69 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AseInputFileWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QPushButton, QFileDialog, QComboBox from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py index 1f8db7fb45..25bd330853 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomMappingWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import json from collections import defaultdict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py index 2f03484a31..4a145e5529 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomSelectionWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from typing import Union, Iterator from itertools import count, groupby from qtpy.QtCore import Qt, QEvent, Slot, QObject diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py index a2054474d4..7b5c7b75c0 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/AtomTransmutationWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py index 07dbfd0511..eab32fa317 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BackupWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from icecream import ic from qtpy.QtWidgets import QLineEdit diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py index 0adcbdacde..9b95fa5aed 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/BooleanWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QCheckBox from qtpy.QtCore import Slot, Qt diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py index 6f8d932e25..bb99140fa4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ComboWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QComboBox from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py index 19b6b7bcda..c6da29ef33 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/DummyWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py index d2bb6f8487..baef0957b9 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FloatWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QDoubleSpinBox from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py index fca4dc6a65..ee76f81f6b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/FramesWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py index d4c62432cc..a147d8e6bf 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/HDFTrajectoryWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os from qtpy.QtWidgets import QLabel diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py index 58cd6d2cd2..e1eda71f7b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputDirectoryWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QFileDialog diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py index 6211f18a2f..f8477b911c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InputFileWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QPushButton, QFileDialog from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py index c09238807d..8b07d2cca5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InstrumentResolutionWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import ( diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py index 9c8648418f..4aac985215 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/IntegerWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QSpinBox diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py index 9deb3ba6f5..b8720a8bdc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/InterpolationOrderWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py index e98a23fa92..8d4869380d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputDirectoryWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QFileDialog diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py index 904f0cfd91..e4f6b3cf5e 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputFilesWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import itertools diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py index e68238e768..c7cba0ee3c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/OutputTrajectoryWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import itertools diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py index 1c205b5550..2dbeda980b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/ProjectionWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QRadioButton, QButtonGroup, QLabel, QHBoxLayout from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py index 21ad0c2e41..36680c2e21 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/QVectorsWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QComboBox, QLabel, QTableView from qtpy.QtCore import Slot, Signal, Qt diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py index 78e4552c25..079584fddb 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RangeWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit, QSpinBox, QLabel from qtpy.QtCore import Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py index f63acd16fd..8bc21de393 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/RunningModeWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import multiprocessing diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py index 5276ea60d8..b33cec4d94 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/StringWidget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtWidgets import QLineEdit from qtpy.QtCore import Slot diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py index 746a5036b5..41e89df85b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/WidgetBase.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from abc import abstractmethod diff --git a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py index 563d45b1ee..dfdea63c12 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/InputWidgets/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import glob import importlib diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/AtomProperties.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/AtomProperties.py index d3a0c586b8..051978485a 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/AtomProperties.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/AtomProperties.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from typing import List diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/ColourManager.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/ColourManager.py index fab3fc250c..a1cded0d8a 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/ColourManager.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/ColourManager.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Maciej Bartkowiak import numpy as np import vtk diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Contents.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Contents.py index 68936488d2..1365f6e9ae 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Contents.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Contents.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Maciej Bartkowiak import numpy as np from qtpy.QtGui import QStandardItemModel, QStandardItem diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Controls.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Controls.py index c3027ea8d5..6e8c1f57e4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Controls.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Controls.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy.QtCore import Signal, Slot, Qt, QTimer, QMutex from qtpy.QtWidgets import ( diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Dummy.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Dummy.py index 06a9f32992..58382d16f5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Dummy.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/Dummy.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Maciej Bartkowiak import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py index 1880bde729..189b43c267 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/MolecularViewer.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import logging from typing import List diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/__init__.py index d855a31764..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/database/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/database/__init__.py index 0306ae5b85..32a1932a92 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/database/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/database/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import os import yaml diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/hdf5wrapper.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/hdf5wrapper.py index 958b6cb06c..88780da8bc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/hdf5wrapper.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/hdf5wrapper.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Maciej Bartkowiak import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/i_reader.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/i_reader.py index 4155379730..7c56ea4d43 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/i_reader.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/i_reader.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import abc import collections diff --git a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/reader_registry.py b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/reader_registry.py index b1f3f5c904..38452a3484 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/reader_registry.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/MolecularViewer/readers/reader_registry.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini REGISTERED_READERS = {} diff --git a/MDANSE_GUI/Src/MDANSE_GUI/PeriodicTableViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/PeriodicTableViewer.py index f300c848c7..8a199f33d8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/PeriodicTableViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/PeriodicTableViewer.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtWidgets import ( QDialog, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py index d855a31764..2f3233dd7d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/__init__.py @@ -13,5 +13,3 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py index 2f4dd407d1..3b11b857b8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import platform diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/cross_viewer_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/cross_viewer_dialog.py index 1ccb77c4d6..93ba224e8d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/cross_viewer_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/cross_viewer_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtGui, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_1d_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_1d_dialog.py index e0121407d0..2565a63c37 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_1d_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_1d_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtGui, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_nd_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_nd_dialog.py index e0e8a3da08..d5f16827d2 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_nd_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/data_viewer_nd_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtGui, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/inspect_data_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/inspect_data_dialog.py index 76f595a05d..12bba832d5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/inspect_data_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/inspect_data_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_axis_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_axis_settings_dialog.py index 61187b11ba..cb9759c5af 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_axis_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_axis_settings_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_general_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_general_settings_dialog.py index 437a1ee14b..fd018c2fc8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_general_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_general_settings_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_lines_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_lines_settings_dialog.py index 2cb6d81abb..e6259e5486 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_lines_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_1d_lines_settings_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_general_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_general_settings_dialog.py index 6c92322c22..6792b90925 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_general_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_general_settings_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_image_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_image_settings_dialog.py index 1b8f11a2be..e923dfc60e 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_image_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_2d_image_settings_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_axis_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_axis_settings_dialog.py index 3eedd740fb..3774fb633e 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_axis_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_axis_settings_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_general_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_general_settings_dialog.py index f0d1df47b3..4a4d0fe63b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_general_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_general_settings_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_image_settings_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_image_settings_dialog.py index bb371d302d..8a28f4b225 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_image_settings_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/plot_nd_image_settings_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/slice_viewer_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/slice_viewer_dialog.py index 8ccc2b07f8..4a28b183b2 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/slice_viewer_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/slice_viewer_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/units_editor_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/units_editor_dialog.py index 1a559879d6..cbb202f5d6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/units_editor_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/units_editor_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import copy diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/viewer_1d_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/viewer_1d_dialog.py index bc17b79b9c..9cc2384a94 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/viewer_1d_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/viewer_1d_dialog.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_popup.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_popup.py index cb8aaf583f..7441e96299 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_popup.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_popup.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import logging diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_widget.py index d0fad1ad13..f9bca8713b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/handlers/logger_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import logging diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_list_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_list_model.py index 22ba159e2a..29a2bb7548 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_list_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_list_model.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_tree_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_tree_model.py index 3a09690af9..71221c465d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_tree_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/data_tree_model.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import abc import os diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py index 876a4d047d..1c5b65f6d8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_2d_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_2d_model.py index cb8ea92898..6ab5d4dbc6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_2d_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_2d_model.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_nd_model.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_nd_model.py index c1e7e75a2a..21c0bb59bc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_nd_model.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_nd_model.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/numeric.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/numeric.py index 7db49794b5..7c4d46cf91 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/numeric.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/numeric.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import copy diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_dict.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_dict.py index 290048cfc4..82b542344a 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_dict.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_dict.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini """Sorted Dict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_list.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_list.py index 01d235ed46..ad0520681a 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_list.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_list.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini """Sorted List diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_set.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_set.py index a718db6b9b..657d552edf 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_set.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/utils/sorted_set.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini """Sorted Set diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/table_views.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/table_views.py index 14fb82eeb8..f1a5b7ba4c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/table_views.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/views/table_views.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/actions_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/actions_widget.py index dffb9e5bb7..6ae3c6813d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/actions_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/actions_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/data_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/data_widget.py index 94f13d9aaf..b1ab65a0aa 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/data_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/data_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/datasets_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/datasets_widget.py index 9b7379fb8f..d8cc989740 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/datasets_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/datasets_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/logger_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/logger_widget.py index 87a8523ee6..8f9466fc00 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/logger_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/logger_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import logging diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/main_window.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/main_window.py index 371d6fbc32..3857d4ac62 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/main_window.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/main_window.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import logging import sys diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_1d_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_1d_widget.py index 9447cb8527..0e32d08219 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_1d_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_1d_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_2d_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_2d_widget.py index 8635557429..117186dcd4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_2d_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_2d_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini import numpy as np diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_actions_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_actions_widget.py index ebd3289b7d..07d7f6cbe1 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_actions_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_actions_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_nd_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_nd_widget.py index b2eae23126..11b6879b60 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_nd_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/plot_nd_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/preview_widget.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/preview_widget.py index 066b0cf67b..cca9fb47b7 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/preview_widget.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/preview_widget.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from pylab import Figure from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/range_slider.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/range_slider.py index 6e20d9743b..bbc143d26f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/range_slider.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/widgets/range_slider.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2023-now -# Authors: Eric Pellegrini from qtpy import QtCore, QtGui, QtWidgets diff --git a/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py index cf0920148b..c846186949 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/RegistryViewer.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now """This module contains a RegistryTree data model, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Resources.py b/MDANSE_GUI/Src/MDANSE_GUI/Resources.py index 954d745028..675064f141 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Resources.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Resources.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtCore import QDir, QSize from qtpy.QtGui import QIcon, QPixmap diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py index e486bbb2db..48978c8912 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_elements_database.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py index aef8a8c716..0fe1990eaf 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_gui.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import sys diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py index 641ee93abd..b142f3c8bc 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_periodic_table.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py index f25ff56080..80717da0c2 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_plotter.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py index d2f82d1538..55c4b4bfd6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Scripts/mdanse_units_editor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now def main(): diff --git a/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py index c2ef0628cc..c3f3798fa4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/SubclassViewer.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now """This module contains a RegistryTree data model, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobStatusProcess.py b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobStatusProcess.py index e2872bb9ed..781a50ac91 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobStatusProcess.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/JobStatusProcess.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Tuple from multiprocessing import Pipe, Queue, Process, Event diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py index c4844f8575..6ad222b9d9 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Subprocess/Subprocess.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from multiprocessing import Pipe, Queue, Process, Event from multiprocessing.connection import Connection diff --git a/MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py b/MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py index 3ceab27644..c75fd9b98f 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/TabbedWindow.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) import os from collections import defaultdict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py index 54d220f8fd..8ba680a594 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/ConverterTab.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from functools import partial from qtpy.QtCore import Slot from qtpy.QtWidgets import QWidget diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py index b2c1eeeca2..a4c0b56f48 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/GeneralTab.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtCore import QObject, Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py index 1f57112eef..0a55ac6643 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/JobTab.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from functools import partial from qtpy.QtCore import Slot from qtpy.QtWidgets import QWidget, QComboBox diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/DoublePanel.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/DoublePanel.py index 3dac7036ca..337437b122 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/DoublePanel.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/DoublePanel.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtWidgets import ( QWidget, QHBoxLayout, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/SinglePanel.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/SinglePanel.py index 6ce50e0e87..00e9ff52e8 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/SinglePanel.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/SinglePanel.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/TriplePanel.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/TriplePanel.py index 7c2b77ce55..30987f6493 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/TriplePanel.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Layouts/TriplePanel.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from .DoublePanel import DoublePanel diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py index 8ab1cf7f43..54469e2a55 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/LoggingTab.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtCore import QObject, Slot, Signal, QMessageLogger, qInstallMessageHandler diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py index 19c149c3d9..c2799186d5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Models/JobHolder.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from multiprocessing import Pipe, Queue, Event diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py index 81168d9949..894309fd88 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/RunTab.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from qtpy.QtCore import QObject, Slot, Signal diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py index a9e7d22086..823703d746 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/TrajectoryTab.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import os from functools import partial diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/ActionsTree.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/ActionsTree.py index 98e2f94bee..d36c6196a5 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/ActionsTree.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/ActionsTree.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union from icecream import ic diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py index 5aca9aa67f..10159ded53 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/RunTable.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from PyQt6.QtCore import QAbstractItemModel, QObject from qtpy.QtCore import Slot, Signal, QModelIndex, Qt diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py index 998ab73ab9..37d469771b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Views/TrajectoryView.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now from typing import Union from qtpy.QtCore import Slot, Signal, QModelIndex diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/Action.py b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/Action.py index e6ce9997e9..182914cea6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/Action.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/Action.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Optional from qtpy.QtWidgets import ( QPushButton, diff --git a/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py b/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py index 415756ef4c..b4350726d1 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/UnitsEditor.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import copy diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertDialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertDialog.py index 72b461a031..d38cc164c3 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertDialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertDialog.py @@ -12,9 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertWizard.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertWizard.py index 438a64f6ed..b89bac01f4 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertWizard.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/ConvertWizard.py @@ -12,9 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/GeneralWidgets.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/GeneralWidgets.py index 8f05f079a2..0de832085c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/GeneralWidgets.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/GeneralWidgets.py @@ -12,9 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Generator.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Generator.py index 4655eeb90b..68b85b49df 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Generator.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Generator.py @@ -12,9 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtWidgets import QWidget, QDockWidget, QScrollArea diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/LoaderButton.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/LoaderButton.py index f4e2a46015..7360dc86ed 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/LoaderButton.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/LoaderButton.py @@ -12,9 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from icecream import ic diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Oscillator.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Oscillator.py index f2e5d8d5f0..dbc2a27206 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Oscillator.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/Oscillator.py @@ -12,9 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from qtpy.QtCore import Slot, Signal, QObject, QTimer from qtpy.QtWidgets import QProgressBar diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/StyleDialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/StyleDialog.py index 2eccdf82dc..d5fbf10a1d 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/StyleDialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/StyleDialog.py @@ -12,9 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) from typing import Union, Iterable, Optional from collections import OrderedDict diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/TrajectoryViewer.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/TrajectoryViewer.py index b5a5d30f8a..0a73263654 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/TrajectoryViewer.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/TrajectoryViewer.py @@ -12,9 +12,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) import typing diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py index 7c66b1fd35..20d9a74365 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Widgets/__init__.py @@ -12,5 +12,3 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now diff --git a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py index b3f5b9cb24..6ec989957c 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now import warnings diff --git a/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py b/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py deleted file mode 100644 index a8f6185d86..0000000000 --- a/MDANSE_GUI/Src/MDANSE_GUI/__pkginfo__.py +++ /dev/null @@ -1,51 +0,0 @@ -# This file is part of MDANSE_GUI. -# -# MDANSE_GUI is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now - -__description__ = "Graphical User Interface for the MDANSE software" - -__long_description__ = """MDANSE is an interactive program for the analysis of Molecular -Dynamics simulations. While it is possible to use MDANSE from the command line, -a GUI has been developed to provide a more complete user experience and visualisation -options. -""" - -__author__ = "M.Bartkowiak, R. Perenon, E.C. Pellegrini, S. Mukhopadhyay, R. Turanyi" - -__author_email__ = ( - "maciej.bartkowiak@stfc.ac.uk, " "sanghamitra.mukhopadhyay@stfc.ac.uk" -) - -__maintainer__ = "S. Mukhopadhyay" - -__maintainer_email__ = "sanghamitra.mukhopadhyay@stfc.ac.uk" - -__former_contributors__ = "G. Goret, B. Aoun, E.C. Pellegrini" - -__url__ = "https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx" - -__repo__ = "https://github.com/ISISNeutronMuon/MDANSE" - -__license__ = "GPL 3" - -__version__ = "0.1.0" - -__date__ = "01-10-2023" - -__commit__ = "undefined" - -__beta__ = "alpha" diff --git a/MDANSE_GUI/Src/MDANSE_GUI/main.py b/MDANSE_GUI/Src/MDANSE_GUI/main.py index 6c29cb92e3..e884c87021 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/main.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/main.py @@ -13,9 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# Copyright (C) Institut Laue Langevin 2013-now -# Copyright (C) ISIS Neutron and Muon Source, STFC, UKRI 2021-now -# Authors: Research Software Group at ISIS (see AUTHORS) import sys import os import time From cc91e9c0d4aeb139584873ca78493e848d7322df Mon Sep 17 00:00:00 2001 From: Chi Cheng Date: Thu, 28 Mar 2024 11:14:08 +0000 Subject: [PATCH 09/11] fixed setup.py --- MDANSE/setup.py | 17 ----------------- MDANSE_GUI/setup.py | 17 ----------------- 2 files changed, 34 deletions(-) diff --git a/MDANSE/setup.py b/MDANSE/setup.py index 355349bb9b..61565908c8 100644 --- a/MDANSE/setup.py +++ b/MDANSE/setup.py @@ -157,14 +157,6 @@ def find_data( return out -################################# -# Packages section -################################# - -PACKAGE_INFO = {} -exec(open("Src/MDANSE/__pkginfo__.py", "r").read(), {}, PACKAGE_INFO) - - ################################# # User data section ################################# @@ -378,15 +370,6 @@ class mdanse_build_api(mdanse_build_doc): setup( name="MDANSE", - version=PACKAGE_INFO["__version__"], - description=PACKAGE_INFO["__description__"], - long_description=PACKAGE_INFO["__long_description__"], - author=PACKAGE_INFO["__author__"], - author_email=PACKAGE_INFO["__author_email__"], - maintainer=PACKAGE_INFO["__maintainer__"], - maintainer_email=PACKAGE_INFO["__maintainer_email__"], - url=PACKAGE_INFO["__url__"], - license=PACKAGE_INFO["__license__"], packages=find_packages("Src"), package_dir={"": "Src"}, data_files=DATA_FILES, diff --git a/MDANSE_GUI/setup.py b/MDANSE_GUI/setup.py index 23c6c75b0e..c8d393b1c3 100644 --- a/MDANSE_GUI/setup.py +++ b/MDANSE_GUI/setup.py @@ -124,14 +124,6 @@ def find_data(where=".", exclude=EXCLUDE, exclude_directories=EXCLUDE_DIRECTORIE return out -################################# -# Packages section -################################# - -PACKAGE_INFO = {} -exec(open('Src/MDANSE_GUI/__pkginfo__.py','r').read(), {}, PACKAGE_INFO) - - ################################# # Documentation ################################# @@ -233,15 +225,6 @@ class mdanse_build_api(mdanse_build_doc): ################################# setup (name = "MDANSE GUI", - version = PACKAGE_INFO["__version__"], - description = PACKAGE_INFO["__description__"], - long_description = PACKAGE_INFO["__long_description__"], - author = PACKAGE_INFO["__author__"], - author_email = PACKAGE_INFO["__author_email__"], - maintainer = PACKAGE_INFO["__maintainer__"], - maintainer_email = PACKAGE_INFO["__maintainer_email__"], - url = PACKAGE_INFO["__url__"], - license = PACKAGE_INFO["__license__"], packages=find_packages("Src"), package_dir={"": "Src"}, platforms = ['Unix','Windows'], From dc7406e77b86d9d668d48e9437845a1961ce7c37 Mon Sep 17 00:00:00 2001 From: Chi Cheng Date: Thu, 28 Mar 2024 11:31:12 +0000 Subject: [PATCH 10/11] __version__ fixes --- MDANSE/Src/MDANSE/Scripts/mdanse.py | 4 ++-- MDANSE/Src/MDANSE/__init__.py | 4 ++-- MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py | 1 - MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py | 5 ++--- MDANSE_GUI/Src/MDANSE_GUI/__init__.py | 4 ++-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/MDANSE/Src/MDANSE/Scripts/mdanse.py b/MDANSE/Src/MDANSE/Scripts/mdanse.py index 0baf11aa41..ba61fe91fe 100644 --- a/MDANSE/Src/MDANSE/Scripts/mdanse.py +++ b/MDANSE/Src/MDANSE/Scripts/mdanse.py @@ -373,11 +373,11 @@ def save_job_template(self, option, opt_str, value, parser): def main(): - from MDANSE.__pkginfo__ import __version__, __date__ + import MDANSE # Creates the option parser. parser = CommandLineParser( - formatter=IndentedHelp(), version="MDANSE %s (%s)" % (__version__, __date__) + formatter=IndentedHelp(), version="MDANSE %s " % MDANSE.__version__ ) # Creates a first the group of general options. diff --git a/MDANSE/Src/MDANSE/__init__.py b/MDANSE/Src/MDANSE/__init__.py index fd28887a6f..e127ff2fb5 100644 --- a/MDANSE/Src/MDANSE/__init__.py +++ b/MDANSE/Src/MDANSE/__init__.py @@ -13,13 +13,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +import importlib.metadata +__version__ = importlib.metadata.version("MDANSE") import warnings warnings.filterwarnings("ignore") -from .__pkginfo__ import __version__, __author__, __date__ - from MDANSE.Core.Platform import PLATFORM import MDANSE.Framework diff --git a/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py b/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py index 22d34456d1..ae88efd3a6 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/BackEnd.py @@ -18,7 +18,6 @@ from icecream import ic from qtpy.QtCore import Slot, QObject, QMutex, Signal -from MDANSE.__pkginfo__ import __author__, __commit__, __version__, __beta__ from MDANSE.Framework.Jobs.IJob import IJob from MDANSE.Framework.Converters.Converter import Converter from MDANSE.Framework.InstrumentResolutions.IInstrumentResolution import ( diff --git a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py index 3b11b857b8..e227e28cec 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/Plotter/dialogs/about_dialog.py @@ -20,8 +20,7 @@ from qtpy import QtCore, QtWidgets -from MDANSE_GUI.Plotter.__pkginfo__ import __version__ -from MDANSE_GUI.Plotter.icons import ICONS +import MDANSE_GUI class AboutDialog(QtWidgets.QDialog): @@ -65,7 +64,7 @@ def _build(self): uname = platform.uname() info = { - "Plotter_version": __version__, + "Plotter_version": MDANSE_GUI.__version__, "h5py_version": h5py.version.version, "hdf5_version": h5py.version.hdf5_version, "qt_version": QtCore.qVersion(), diff --git a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py index 6ec989957c..3facdceb38 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py @@ -13,13 +13,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +import importlib.metadata +__version__ = importlib.metadata.version("MDANSE_GUI") import warnings warnings.filterwarnings("ignore") -from .__pkginfo__ import __version__, __author__, __date__ - import vtk vtk.vtkObject.GlobalWarningDisplayOff() From 21561265133fcca01811e591704d09094900857d Mon Sep 17 00:00:00 2001 From: Chi Cheng Date: Thu, 28 Mar 2024 11:36:39 +0000 Subject: [PATCH 11/11] applied black --- MDANSE/Src/MDANSE/__init__.py | 1 + MDANSE_GUI/Src/MDANSE_GUI/__init__.py | 1 + 2 files changed, 2 insertions(+) diff --git a/MDANSE/Src/MDANSE/__init__.py b/MDANSE/Src/MDANSE/__init__.py index e127ff2fb5..e7d5d9de5a 100644 --- a/MDANSE/Src/MDANSE/__init__.py +++ b/MDANSE/Src/MDANSE/__init__.py @@ -14,6 +14,7 @@ # along with this program. If not, see . # import importlib.metadata + __version__ = importlib.metadata.version("MDANSE") import warnings diff --git a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py index 3facdceb38..81690df15b 100644 --- a/MDANSE_GUI/Src/MDANSE_GUI/__init__.py +++ b/MDANSE_GUI/Src/MDANSE_GUI/__init__.py @@ -14,6 +14,7 @@ # along with this program. If not, see . # import importlib.metadata + __version__ = importlib.metadata.version("MDANSE_GUI") import warnings