Skip to content

Commit

Permalink
fix seed SimulatedLIBS
Browse files Browse the repository at this point in the history
  • Loading branch information
MKastek committed May 28, 2024
1 parent ba1638c commit a390026
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions SimulatedLIBS/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ def worker(
Ne_max: float,
webscraping: str,
):

percentages = input_df.iloc[random.randrange(num_of_materials)].values[:-1]
elements = input_df.iloc[random.randrange(num_of_materials)].keys().values[:-1]
name = input_df.iloc[random.randrange(num_of_materials)]["name"]
seed = random.randrange(num_of_materials)
percentages = input_df.iloc[seed].values[:-1]
elements = input_df.iloc[seed].keys().values[:-1]
name = input_df.iloc[seed]["name"]
Te = random.uniform(Te_min, Te_max)
Ne = random.uniform(Ne_min, Ne_max)
fun = SimulatedLIBS(
Expand Down Expand Up @@ -403,6 +403,7 @@ def create_dataset(
"""
input_df = pd.read_csv(input_csv_file)
print(input_df)
num_of_materials = len(input_df)
pool = ThreadPoolExecutor(size)
spectra_pool = [
Expand Down Expand Up @@ -444,11 +445,3 @@ def create_dataset(
output_df.reset_index(drop=True)
output_df.to_csv(output_csv_file)
return output_df


if __name__ == "__main__":
libs = SimulatedLIBS(
elements=["He", "W"], percentages=[50, 50], webscraping="static"
)
libs.plot()
plt.show()

0 comments on commit a390026

Please sign in to comment.