-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,29 +28,29 @@ jobs: | |
uses: microsoft/[email protected] | ||
- name: Conda build' | ||
env: | ||
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} | ||
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | ||
shell: bash -l {0} | ||
run: | | ||
conda install -c conda-forge conda-build anaconda-client -y | ||
conda build -c anaconda -c conda-forge -c loop3d --output-folder conda conda | ||
conda install anaconda-client -y | ||
- name: upload windows | ||
env: | ||
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} | ||
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | ||
if: matrix.os == 'windows-latest' | ||
shell: bash -l {0} | ||
run: | | ||
anaconda upload --label main conda/win-64/*.tar.bz2 | ||
- name: upload linux | ||
env: | ||
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} | ||
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | ||
if: matrix.os == 'ubuntu-latest' | ||
shell: bash -l {0} | ||
run: | | ||
anaconda upload --label main conda/linux-64/*.tar.bz2 | ||
- name: upload macosx | ||
env: | ||
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} | ||
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | ||
if: matrix.os == 'macos-latest' | ||
shell: bash -l {0} | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,43 @@ | ||
import numpy as np | ||
|
||
|
||
def sample_random_dataset(grid, sample_size=2, seed=180): | ||
def sample_random_dataset(bounding_box, sample_size=2, seed=180): | ||
""" | ||
Generate a random dataset of 3D coordinates within a specified model bounding box. | ||
Parameters | ||
---------- | ||
bounding_box : ndarray | ||
A 3x3 array where each row represents the minimum and maximum values of x and y coordinates. | ||
sample_size : int, optional | ||
The number of random samples to generate. Default is 2. | ||
seed : int, optional | ||
The seed for the random number generator for reproducibility. Default is 180. | ||
Returns | ||
------- | ||
random_xyz : ndarray | ||
A sample_size x 3 array of random 3D coordinates within the specified bounding box. | ||
""" | ||
# Set the seed for the random number generator for reproducible results | ||
np.random.seed(seed) | ||
# select all xy points with z = 0 | ||
xyz = grid[grid[:, 2] == 0] | ||
xmax = xyz[:, 0].max() | ||
ymax = xyz[:, 1].max() | ||
|
||
# Extract the maximum x and y coordinates from the bounding box | ||
xmax, ymax = bounding_box[1, 0], bounding_box[1, 1] | ||
|
||
# Define the maximum z coordinate (fixed at 0 to only sample model's surface) | ||
zmax = 0. | ||
xn = np.random.uniform(low=0, high=xmax, size=sample_size) | ||
yn = np.random.uniform(low=0, high=ymax, size=sample_size) | ||
|
||
# Generate 'sample_size' number of random x-coordinates | ||
xn = np.random.uniform(low=bounding_box[0, 0], high=xmax, size=sample_size) | ||
|
||
# Generate 'sample_size' number of random y-coordinates | ||
yn = np.random.uniform(low=bounding_box[0, 1], high=ymax, size=sample_size) | ||
|
||
# Create an array of z-coordinates, all set to 'zmax' (fixed z-coordinate for all points) | ||
zn = np.tile(zmax, sample_size) | ||
|
||
# Combine the x, y, and z coordinates into a single 2D array (shape: sample_size x 3) | ||
random_xyz = np.array([xn, yn, zn]).T | ||
|
||
return random_xyz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters