-
Notifications
You must be signed in to change notification settings - Fork 1
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
5 changed files
with
60 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
**/.DS_Store |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM matpower/octave:latest@sha256:5d1683c81873c56a37774bc7c42ef3d78a7e107781e974a1b8957073bac4436a | ||
|
||
ARG OCTAVE_VERSION="9.2.0" | ||
ARG OCTAVE_IMAGE_REVISION="1" | ||
|
||
RUN mkdir /safe_data /safe_outputs /scratch /test | ||
|
||
WORKDIR /test | ||
|
||
COPY --chmod=0755 src/* . | ||
|
||
CMD ["/bin/bash", "run_octave.sh"] |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# TRE Octave example | ||
|
||
## Running | ||
|
||
Run with standard `ces-run` command. | ||
|
||
## Notes | ||
|
||
In this example, a bash script uses an octave script to generate a plot and then saves the `.png` output to `/safe_outputs`. Both files are found under the `src` directory, which is copied inside the container in the `Dockerfile`. | ||
|
||
This example is not interactive. |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
% declaring variable var_x | ||
var_x = [0:0.01:1]; | ||
|
||
% declaring variable var_y1 | ||
var_y1 = sin(4 * pi * var_x); | ||
|
||
% declaring variable var_y2 | ||
var_y2 = cos(3 * pi * var_x); | ||
|
||
% plot var_x with var_y1 | ||
plot(var_x, var_y1); | ||
|
||
% hold the above plot or figure | ||
hold on; | ||
|
||
% plot var with var_y2 with red color | ||
plot(var_x, var_y2, 'r'); | ||
|
||
% adding label to the x-axis | ||
xlabel('time'); | ||
|
||
% adding label to the y-axis | ||
ylabel('value'); | ||
|
||
% adding title for the plot | ||
title('my first plot'); | ||
|
||
% add legends for these 2 curves | ||
legend('sin', 'cos'); | ||
|
||
print -dpng 'plot.png' |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
octave plot_example.m | ||
|
||
mv *.png /safe_outputs |