Skip to content

Commit

Permalink
Changed keyword names in plot_heatmap:
Browse files Browse the repository at this point in the history
phase_diagram to phasediagram
energy_slope to energyslope
final_time to finaltime
tod_dif to dtof
  • Loading branch information
hprats committed Dec 18, 2024
1 parent a21c611 commit 9452cb9
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 87 deletions.
30 changes: 15 additions & 15 deletions docs/source/plotting_results.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ When running a set of KMC simulations at various operating conditions, 2D heatma

- **`z`** (`str`): Magnitude to plot on the z-axis. Possible values:
- `'tof'`: log₁₀ TOF (molec·s⁻¹·Å⁻²).
- `'tof_dif'`: Difference in log₁₀ TOF between two systems.
- `'dtof'`: Difference in log₁₀ TOF between two systems.
- `'selectivity'`: Selectivity (%).
- `'coverage'`: Coverage (%).
- `'phase_diagram'`: Most dominant surface species.
- `'final_time'`: log₁₀ Final time (s).
- `'phasediagram'`: Most dominant surface species.
- `'finaltime'`: log₁₀ Final time (s).
- `'final_energy'`: Final energy (eV·Å⁻²).
- `'energy_slope'`: Energy slope (eV·Å⁻²·step⁻¹).
- `'energyslope'`: Energy slope (eV·Å⁻²·step⁻¹).
- `'issues'`: To check for issues.

Depending on the type of plot (`z`), some additional parameters might be needed (see below).
Expand Down Expand Up @@ -200,7 +200,7 @@ plt.show()

#### TOF difference

`z = 'tof_dif'`, plot the TOF difference (∆TOF, in molec·s⁻¹·Å⁻²) of a given gas-phase species between two simulations.
`z = 'dtof'`, plot the TOF difference (∆TOF, in molec·s⁻¹·Å⁻²) of a given gas-phase species between two simulations.

**Additional parameters:**

Expand All @@ -217,7 +217,7 @@ Optional:
- `'time'` (based on simulated time)
- `'nevents'` (based on the number of events)

**Note:** The `min_molec` parameter is not allowed in `z = 'tof_dif'` plots.
**Note:** The `min_molec` parameter is not allowed in `z = 'dtof'` plots.

**Example:**

Expand All @@ -234,7 +234,7 @@ plot_heatmap(
scan_path_ref='simulation_results_reference',
x='pressure_CH4',
y='pressure_CO2',
z='tof_dif',
z='dtof',
gas_spec='H2',
min_molec=0,
analysis_range=[50, 100],
Expand Down Expand Up @@ -359,7 +359,7 @@ plt.show()

#### Phase diagram

`z = 'phase_diagram'`, plot the most dominant surface species.
`z = 'phasediagram'`, plot the most dominant surface species.

**Additional parameters:**

Expand Down Expand Up @@ -387,7 +387,7 @@ plot_heatmap(
scan_path='simulation_results',
x='pressure_CH4',
y='pressure_CO2',
z='phase_diagram',
z='phasediagram',
min_coverage=50.0,
site_type='tC',
surf_spec_values={
Expand Down Expand Up @@ -421,7 +421,7 @@ plt.show()

#### Final time

`z = 'final_time'`, plot the final time of the simulation (in s).
`z = 'finaltime'`, plot the final time of the simulation (in s).

**Additional parameters:**

Expand All @@ -443,7 +443,7 @@ plot_heatmap(
scan_path='simulation_results',
x='pressure_CH4',
y='pressure_CO2',
z='final_time',
z='finaltime',
levels=np.logspace(-5, 7, num=13),
verbose=True,
auto_title=True,
Expand All @@ -460,7 +460,7 @@ plt.show()

#### Energy slope

`z = 'energy_slope'`, plot the slope of the lattice energy (in eV·Å⁻²·step⁻¹).
`z = 'energyslope'`, plot the slope of the lattice energy (in eV·Å⁻²·step⁻¹).

A high slope of the lattice energy indicates that the simulation might have not reached the steady state.

Expand All @@ -485,7 +485,7 @@ plot_heatmap(
scan_path='simulation_results',
x='pressure_CH4',
y='pressure_CO2',
z='energy_slope',
z='energyslope',
range_type='nevents',
auto_title=True,
show_points=False,
Expand Down Expand Up @@ -585,7 +585,7 @@ for n, site_type in enumerate(['tC', 'tM', 'Pt']):

for n, site_type in enumerate(['tC', 'tM', 'Pt']):
plot_heatmap(
ax=axs[2, n], scan_path=scan_path, x=x_variable, y=y_variable, z="phase_diagram",
ax=axs[2, n], scan_path=scan_path, x=x_variable, y=y_variable, z="phasediagram",
min_coverage=min_coverage, site_type=site_type,
surf_spec_values={
'CH3': 0.5, 'CH3_Pt': 0.5, 'CH2': 0.5, 'CH2_Pt': 0.5, 'CH': 0.5, 'CH_Pt': 0.5, 'C': 0.5,
Expand All @@ -611,7 +611,7 @@ plot_heatmap(
auto_title=auto_title, show_points=show_points, show_colorbar=show_colorbar)

plot_heatmap(
ax=axs[3, 1], scan_path=scan_path, x=x_variable, y=y_variable, z='final_time',
ax=axs[3, 1], scan_path=scan_path, x=x_variable, y=y_variable, z='finaltime',
levels=np.logspace(-7, 7, num=15), auto_title=auto_title, show_points=show_points, show_colorbar=show_colorbar)

# Hide axis labels of intermediate subplots
Expand Down
6 changes: 3 additions & 3 deletions docs/source/reading_output_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ All KMC results can be obtained from the different `KMCOutput` attributes.
### Simulated time

- **`time`** (*np.ndarray*): Simulated time (in seconds).
- **`final_time`** (*float*): Final simulated time (in seconds).
- **`finaltime`** (*float*): Final simulated time (in seconds).

### Lattice energy

- **`energy`** (*np.ndarray*): Lattice energy (in eV·Å⁻²).
- **`av_energy`** (*float*): Average lattice energy (in eV·Å⁻²).
- **`final_energy`** (*float*): Final lattice energy (in eV·Å⁻²).
- **`energy_slope`** (*float*): Slope of the lattice energy over the number of events (in eV·Å⁻²·step⁻¹). A high value may indicate that the simulation has not reached steady-state.
- **`energyslope`** (*float*): Slope of the lattice energy over the number of events (in eV·Å⁻²·step⁻¹). A high value may indicate that the simulation has not reached steady-state.

### Molecules consumed/produced and TOF

Expand Down Expand Up @@ -158,5 +158,5 @@ for site_type in kmc_output.site_types:
### Energy slope

```python
print(f"Energy slope: {kmc_output.energy_slope:.3e} eV·Å⁻²·step⁻¹")
print(f"Energy slope: {kmc_output.energyslope:.3e} eV·Å⁻²·step⁻¹")
```
2 changes: 1 addition & 1 deletion examples/DRM_on_PtHfC/dtof_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
scan_path_ref='simulation_results_reference',
x='pressure_CH4',
y='pressure_CO2',
z='tof_dif',
z='dtof',
gas_spec='H2',
min_molec=0,
analysis_range=[50, 100],
Expand Down
2 changes: 1 addition & 1 deletion examples/DRM_on_PtHfC/energyslope_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
scan_path='simulation_results',
x='pressure_CH4',
y='pressure_CO2',
z='energy_slope',
z='energyslope',
range_type='nevents',
auto_title=True,
show_points=False,
Expand Down
2 changes: 1 addition & 1 deletion examples/DRM_on_PtHfC/finaltime_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
scan_path='simulation_results',
x='pressure_CH4',
y='pressure_CO2',
z='final_time',
z='finaltime',
levels=np.logspace(-5, 7, num=13),
verbose=True,
auto_title=True,
Expand Down
4 changes: 2 additions & 2 deletions examples/DRM_on_PtHfC/multiple_heatmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

for n, site_type in enumerate(['tC', 'tM', 'Pt']):
plot_heatmap(
ax=axs[2, n], scan_path=scan_path, x=x_variable, y=y_variable, z="phase_diagram",
ax=axs[2, n], scan_path=scan_path, x=x_variable, y=y_variable, z="phasediagram",
min_coverage=min_coverage, site_type=site_type,
surf_spec_values={
'CH3': 0.5, 'CH3_Pt': 0.5, 'CH2': 0.5, 'CH2_Pt': 0.5, 'CH': 0.5, 'CH_Pt': 0.5, 'C': 0.5,
Expand All @@ -63,7 +63,7 @@
auto_title=auto_title, show_points=show_points, show_colorbar=show_colorbar)

plot_heatmap(
ax=axs[3, 1], scan_path=scan_path, x=x_variable, y=y_variable, z='final_time',
ax=axs[3, 1], scan_path=scan_path, x=x_variable, y=y_variable, z='finaltime',
levels=np.logspace(-7, 7, num=15), auto_title=auto_title, show_points=show_points, show_colorbar=show_colorbar)

# Hide axis labels of intermediate subplots
Expand Down
2 changes: 1 addition & 1 deletion examples/DRM_on_PtHfC/phasediagram_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
scan_path='simulation_results',
x='pressure_CH4',
y='pressure_CO2',
z='phase_diagram',
z='phasediagram',
min_coverage=50.0,
site_type='tC',
surf_spec_values={
Expand Down
4 changes: 2 additions & 2 deletions zacrostools/detect_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def detect_issues(path, analysis_range):

energy_slope_threshold = 5.0e-10 # eV/Ų/step
energyslope_threshold = 5.0e-10 # eV/Ų/step
time_linear_fit_threshold = 0.95

def reduce_size(time, energy, nevents, size=100):
Expand All @@ -25,7 +25,7 @@ def reduce_size(time, energy, nevents, size=100):
# Check for a positive or negative trend in energy using linear regression
coeffs_energy = np.polyfit(nevents_reduced, energy_reduced, 1)
slope_energy = coeffs_energy[0]
energy_trend = abs(slope_energy) > energy_slope_threshold
energy_trend = abs(slope_energy) > energyslope_threshold

# Perform linear regression on time vs. nevents
coeffs_time = np.polyfit(nevents_reduced, time_reduced, 1)
Expand Down
6 changes: 3 additions & 3 deletions zacrostools/kmc_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class KMCOutput:
Number of events occurred.
time : np.ndarray
Simulated time (in seconds).
final_time : float
finaltime : float
Final simulated time (in seconds).
energy : np.ndarray
Lattice energy (in eV·Å⁻²).
Expand Down Expand Up @@ -125,9 +125,9 @@ def __init__(self, path: str, analysis_range: Union[list, None] = None, range_ty

self.nevents = data_specnum[:, 1]
self.time = data_specnum[:, 2]
self.final_time = data_specnum[-1, 2]
self.finaltime = data_specnum[-1, 2]
self.energy = data_specnum[:, 4] / self.area # in eV/Å2
self.energy_slope = abs(np.polyfit(self.nevents, self.energy, 1)[0]) # in eV/Å2/step
self.energyslope = abs(np.polyfit(self.nevents, self.energy, 1)[0]) # in eV/Å2/step
self.final_energy = data_specnum[-1, 4] / self.area
self.av_energy = self.get_average(array=self.energy, weights=weights)

Expand Down
Loading

0 comments on commit 9452cb9

Please sign in to comment.