Commit 1191d8e6 authored by Islam, Fahima's avatar Islam, Fahima
Browse files

Update file FINAL-distribution_reduction_from_mcvine-output.ipynb

parent f10ff3f8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
%% Cell type:code id:5a701f66 tags:

``` python
import sys
sys.path.append("../source_code")
import numpy as np
import matplotlib.pyplot as plt
import time
import h5py
```

%% Cell type:code id:62b7c868 tags:

``` python
from post_processing_events import process_neutron_events
```

%% Cell type:markdown id:80ddd0eb tags:

# Reading Q and S(Q) Data from HDF5 File obtained from atomistic simulation

%% Cell type:code id:ba3e2ab7 tags:

``` python
with h5py.File('Ar.h5', 'r') as file:
        # Access the datasets
        q_values = file['S/grid/Q/bin centers'][:]
        intensity_values = file['S/data'][:]
```

%% Cell type:markdown id:32128d01 tags:

# Setting Paths for Argon and Vanadium Simulation Data

%% Cell type:code id:c9c3b227 tags:

``` python
simdir_Ar = "work-Ar_NOMAD_1E9/"
simdir_V = "work-Vanadium_NOMAD_det_updated/" #1e8
```

%% Cell type:markdown id:06386595 tags:

# Processing Neutron Events for Ar data

%% Cell type:code id:414152af tags:

``` python
start_time = time.time()
q_bin_3_4_5, I_bin_3_4_5, e_bin_3_4_5= process_neutron_events(simdir_Ar,first_bank=38,last_bank=82,
                                               L_ms=19.75, q_bins=100, q_range_=(0,30))

# End timer
end_time = time.time()

# Print execution time
execution_time = end_time - start_time
minutes = int(execution_time // 60)
seconds = execution_time % 60

# Print formatted time
print(f"Execution Time: {minutes} minutes and {seconds:.2f} seconds")
```

%% Output

    521943
    Execution Time: 0 minutes and 16.69 seconds

%% Cell type:markdown id:9c8d71a6 tags:

# Processing Neutron Events for vanadium data

%% Cell type:code id:fc757764 tags:

``` python
start_time = time.time()
q_bin_V_3_4_5, I_bin_V_3_4_5, e_bin_V_3_4_5= process_neutron_events(simdir_V, first_bank=38,last_bank=82,
                                               L_ms=19.75, q_bins=100, q_range_=(0,30))

# End timer
end_time = time.time()

# Print execution time
execution_time = end_time - start_time
minutes = int(execution_time // 60)
seconds = execution_time % 60

# Print formatted time
print(f"Execution Time: {minutes} minutes and {seconds:.2f} seconds")
```

%% Output

    120069
    Execution Time: 0 minutes and 2.05 seconds

%% Cell type:markdown id:1126d508 tags:

# Comparing MCRT for NOMAD and Atomistic Simulations of 𝑆(𝑄) for Argon

%% Cell type:code id:4912a426 tags:

``` python
plt.figure(figsize=(3, 4))
plt.plot(q_bin_3_4_5, (I_bin_3_4_5/I_bin_V_3_4_5)*0.013, label='MCRT simulated S(Q) of Ar in NOMAD')
plt.plot(q_values, intensity_values, label= 'atomistic simulated S(Q) of Ar')
plt.xlabel('Q')
plt.ylabel('Intensity')
# plt.ylim(0.9,1.02)
plt.xlim(1.5,12)
# plt.yscale('log')
plt.legend()
plt.grid(True)
plt.show()
```

%% Output


%% Cell type:code id:b3b58ee8 tags:

``` python
```