Skip to content

Commit

Permalink
Merge pull request #16 from NREL/compactInstall
Browse files Browse the repository at this point in the history
fix plot and compact install
  • Loading branch information
malihass authored Nov 28, 2023
2 parents 2db6c23 + f99489e commit 9f9b278
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Formatting and sorting import
- name: Formatting
run: |
source .github/linters/formatting.sh
format *.py true
format utils true
codespell
- name: Normalizing flow test
run: |
python main_iterative.py -i tests/input_test
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

1. `conda create --name uips python=3.10`
2. `conda activate uips`
3. `conda install openmpi`
4. `pip install -r requirements.txt`
3. `pip install -r requirements.txt`

### Option 2: From `poetry`

Expand All @@ -20,7 +19,7 @@ This requires [poetry](https://python-poetry.org/docs/#installation)

## Purpose

The purpose of the tool is to perform a smart downselection of a large number of datapoints. Typically, large numerical simulations generate billions, or even trillions of datapoints. However, there may be redundancy in the dataset which unecessarily constrains memory and computing requirements. Here, redundancy is defined as closeness in feature space. The method is called phase-space sampling.
The purpose of the tool is to perform a smart downselection of a large number of datapoints. Typically, large numerical simulations generate billions, or even trillions of datapoints. However, there may be redundancy in the dataset which unnecessarily constrains memory and computing requirements. Here, redundancy is defined as closeness in feature space. The method is called phase-space sampling.

## Running the example without poetry

Expand Down
2 changes: 1 addition & 1 deletion data-efficientML/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This folder is NOT necessary for using the phase-space sampling package. It only
Uniform-in-phase-space data-selection with iterative normalizing flows, Under review.

# Data
The folder `data/` contains the phase space sampled data for five independent runs of each case described in the paper aforementionned. To run all the codes and reproduce the results, the file `fullData.npy` is necessary. Due to space constraints it is not in the repository but is available upon request.
The folder `data/` contains the phase space sampled data for five independent runs of each case described in the paper aforementioned. To run all the codes and reproduce the results, the file `fullData.npy` is necessary. Due to space constraints it is not in the repository but is available upon request.


# Usage
Expand Down
1 change: 1 addition & 0 deletions fixFormat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ source .github/linters/formatting.sh

format *.py
format utils
codespell
2 changes: 1 addition & 1 deletion main_iterative.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# import matplotlib.pyplot as plt

sys.path.append("utils")
import argparse
import time

import parallel as par
Expand All @@ -17,7 +18,6 @@
import sampler
import utils

import argparse
parser = argparse.ArgumentParser(description="Downsampler")
parser.add_argument(
"-i",
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
openmpi
torch
numpy
mpi4py
scikit-learn
prettyPlot>=0.0.10
black
isort
codespell
9 changes: 3 additions & 6 deletions visualizeDownSampled_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def plotScatterProjection(data, fullData, fieldNames, lims):
tick.set_rotation(33)
ax.set_ylim(lims[1])

plt.tight_layout()

import argparse
parser = argparse.ArgumentParser(description="Visualize downsampled data")
parser.add_argument(
Expand Down Expand Up @@ -118,12 +120,7 @@ def plotScatterProjection(data, fullData, fieldNames, lims):
downSampledData = fullData[np.load(dataFile)["indices"], :]
plotScatterProjection(downSampledData, fullData, fieldNames, lims)
plt.savefig(
figureFolder
+ "/"
+ inpt["prefixDownsampledData"]
+ "_"
+ str(nSample)
+ ".png"
os.path.join(figureFolder, f"{inpt['prefixDownsampledData']}_{nSample}_it{pdf_iter}.png")
)
plt.close()
print("DONE!")
Expand Down

0 comments on commit 9f9b278

Please sign in to comment.