Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with sportran master #1

Merged
merged 176 commits into from
Sep 16, 2024
Merged

Merge with sportran master #1

merged 176 commits into from
Sep 16, 2024

Conversation

ppegolo
Copy link
Owner

@ppegolo ppegolo commented Sep 16, 2024

No description provided.

rikigigi and others added 30 commits March 23, 2020 16:29
There was an error When computing acf for 1-D 1-component trajectories.
Now if a (N) array is passed, a trajectory (N,1) will be initialized.
- md.mdsample :
  - freq_red_to_THz defined.
  - FILTER_WINDOW_WIDTH renamed PSD_FILTER_W. PSD_FILTER_W_THZ introduced.
    It should be backward-compatible, FILTER_WINDOW_WIDTH should not be
used anymore anywhere.
  - frequency units support introduced into filter_psd.
- heatcurrent :
  - freq_THz_to_red  function moved to md.mdsample.
  - functions calling plot_psd and filter_psd have been simplified.
  - TODO: check and fix filter_psd behavior in resample_current
- Some cleaning and comments rewritten.
- md.mdsample :
  - FILTER_WF renamed PSD_FILTER_WF.
  - MULTI_COMPONENT renamed MANY_COMPONENTS. It indicates that there are N_COMPONENTS CARTESIAN components (to avoid confusion with multi-current/component code)
  - NOTE: filter_psd will use the window given OR the internal value if present

- heatcurrent :
  - many_currents renamed MANY_CURRENTS
  - N_CURRENTS variable defined
  - units renamed UNITS
  - initialization separated into several methods
  - __repr__ updated
  - NOTE: plot_periodogram will call filter_psd, that will use the window value given or the internal one. If it is not defined, it will use 0. (it will return a non-filtered psd)
- TODO: check that multi-components routines all work.
    Fix bugs in reading Volume from flux data file and if user specifies --TSKIP
New folder `md/tools` contains:
 - `acf.py`: ACF direct computation and integration.
   (`integrate_acf`, `acf`, `acovf`, `ccf`, `ccovf` functions)
 - `filter.py`: filtering functions. (`runavefilter`)
 - `resample.py`: resampling functions.
   (`filter_and_sample`, `resample_psd`)
 - `spectrum.py`: spectrum-related functions.
   (`freq_THz_to_red`, `freq_red_to_THz`, `logtau_to_tau`,
`generate_empirical_spectrum`)
 - `armodel.py`: AR model related stuff (obsolete).
 - `lpfilter.py`: low-pass filter (obsolete).

Other edits:
 - Some import of tools in `md/mdsample.py` and `heatcurrent.py` moved
to the top of the file.
 - Modified some __init__ files to import the minimum number of modules
required to populate the interface.
Setup will install all core & GUI, using all the dependencies.
`future-fstrings` no longer required.
utf-8 coding string added to the header of all files.
Some tools were missing imports.
I also import the logger in `mdsample`.
I fixed the bug that was throwing an error when calling `__repr__` in
the single-current case, because `otherMD` was not defined.
- `HeatCurrent.__init__`: `j` has been renamed `traj`.
- Now the default freq_units are always 'THz'. This has been modified
in:
  - `HeatCurrent.compute_psd`
  - `MDSample.filter_psd`
A `_get_builder` method has been defined in `MDSample` and
`HeatCurrent`. It returns the class of the object and a dictionary that
can be used to rebuild the same object from scratch, using the
initializer.
The new `MDSample.resample` method performs the filter & resample that
was previously performed by `resample_currents`. It calls the function
`resample_timeseries` defined in `md/resample.py`.
This works for any MDSample-derivated class, e.g. a `HeatCurrent`.
It uses the `_get_builder` method of the class to get the parameters
needed to define a new object of the same type, with `trajectory` and
`DT_FS` updated.

To resample a time series, you just need to call its method:
  j_new = j.resample(TSKIP, ...)

The trajectory read by `resample_timeseries` can be 1D, 2D, or 3D. In
the latter case (multi-current), the `filter_and_sample` is applied to
each row in the first dimension (each current) separately, and the 3D
trajectory is reconstructed afterwards.

TODO: the plot functions of `resample_timeseries` are disabled, because
`MDSample` does not have a `plot_periodogram` method. For now plots are
performed in the `HeatCurrent.resample` method.
The `Current` becomes the base class for any current associated to a
transport coefficient. `HeatCurrent` is now subclassed from it.
These classes have been separated and moved to `current/` directory.

A `Current` is defined from a trajectory and a undefined number of
key arguments (**params). The precise list of parameters (constants)
needed by a current can be specified by defining the `_input_parameters`
and `_optional_parameters` class attributes.

NOTE: it is not possible to define a Current object with positional
arguments. Apart from the trajectory, all the other parameters must be
passed as key arguments. E.g.
  j = HeatCurrent(traj, DT_FS=1.0, TEMPERATURE=300., VOLUME=100.,
                  UNITS='metal')
These key arguments are case-insensitive.

To define a new current, one just needs to define the `_get_builder`,
`get_units_list`, and `initialize_units` methods, at least, which are
virtual (not defined in the `Current` class).

TODO: find a way to scan the folder `current/units` to get a list of
available units for a particular `_current_type` (heat, electric, ...).
- `Nfreqs` -> `NFREQS`
- `DF_THz` -> `DF_THZ`
tk_html_widgets were modified by yapf
Moved plt_cepstral_cov, plt_other, plt_psd, _n_tick_in_range and _index_cumsum from
analysis.py to plotter.py as staticmethods of Plotter
Moved plot_periodogram, plot_ck, plot_L0_Pstar, plot_kappa_Pstar, plot_cepstral_spectrum, plot_fstar_analysis
and plt_resample content from current.py to plotter.py as staticmethods.
plot_periodogram, plot_ck, plot_L0_Pstar, plot_kappa_Pstar, plot_cepstral_spectrum, plot_fstar_analysis
and plt_resample in Current now are call to Plotter staticmethods
Now you should pass a Plotter instance when creating a new Current to display graphs.
…pectrum

from thermocepstrum_gui/utils/Graph.py to Plotter as staticmethods.
Removed thermocepstrum_gui/utils/Graph.py and fixed imports.
Added plot class variable (plotter instance) to Current to manage
plot functions instead of passing it by parameter.
Changed graphManager in control_unit -> now is Plotter instance.
Changed GUI_resample_current contest, now is a staticmethod; x parameter
refactored to current.
Various fixing in Plotter class.
Fixed HeatCurrent imports in control_unit and analysis.

TO FIX: in GUI_resample_current FILTER_WINDOW_WIDTH doesn't exist anymore
as Current parameter (according to commit
0e33dc9). Replace it.
Now CI tests work.
However, we shall implement pytest fixtures to do a better job.
…ACTOR

`Current` now can be used directly, by defining the `KAPPA_SCALE` input
parameter, that is the factor in front of the Green-Kubo integral.

New optional parameters:
 - `MAIN_CURRENT_INDEX` that selects the column of the trajectory array
that contains the main current. The other columns are used as additional
currents.
 - `MAIN_CURRENT_FACTOR` that is a factor to be multiplied by the main
current only. The other currents will not be touched.
the plot modules.
Added a function to set_plotter method to Current.
Renamed "x" parameter to "current" in GUI_plot_cepstral_spectrum,
GUI_plot_periodogram and GUI_resample_current.
Fixed some issue in the GUI.
lorisercole and others added 29 commits June 25, 2022 17:38
Fixes #18
Contributes to #23
The LAMMPS input files used to generate the silica example data have
been added to the `examples/data/Silica/lammps` folder.
In the same folder, the output of the calculation is reported, along
with a script to convert it to `table` and `dict` formats.
The data had to be regenerated, therefore all the data files in the
example folder have been updated.
Tests using Silica data had to be updated after commit be12473
We also added a script to regenerate the data in the format required by
tests, for convenience.
If EOF was reached, the number of steps NSTEPS was not updated and the
initialized data vectors were not resized.
Now it is fixed.
- The documentation has been updated.
- `lammps_structure_file` has been renamed `lammps_data_file`
- `get_box` function is imported from the `read_lammps_datafile` module
binary.py moved to `_sportran_binary`
It is a module still under development.
and fix `convert_lammps_log.sh` script
Removal of unused or wrong conversion factors
…notebook with inputs format example also in docs
'Energy current' changed to 'Main current'.
- The plot style files have been added to the package data, this fixes and
error that can happen in certain installations, for which these files
cannot be retrieved because they are not installed.
- Package metadata has been updated: development status is now
"Production/Stable", and other categories added.
- Some dependencies have been bumped. New python version may still have
problems to install the minimum deps versions.
* fixes #66 - there was a bug in `sportran-analysis` when the moving average window was not specified.
* added test for cli when the user don't ask for the filtering of the data with the moving average approach
* version updated to 1.0rc3

Co-authored-by: Loris Ercole <[email protected]>
* fixes #66 - there was a bug in `sportran-analysis` when the moving average window was not specified.
* added test for cli when the user don't ask for the filtering of the data with the moving average approach
* version updated to 1.0rc3

Co-authored-by: Loris Ercole <[email protected]>
python 3.6 reached End of Life, so it was removed
updated pytest-regression that was not compatible with the latest numpy
versions.
updated CI tests to run from 3.7 to 3.11 (included) python versions

solves #68
removed python 3.6 support, added python 3.11
fixed python version requirement by removing the ".*" in >=3.6.*
@ppegolo ppegolo merged commit a883e8d into ppegolo:master Sep 16, 2024
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants