Created
October 5, 2025 10:25
-
-
Save hanjinliu/ba5e58edfe2f912899cb5e2b9dc404ec to your computer and use it in GitHub Desktop.
An example of running gist script from himena
This file contains hidden or 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
| import numpy as np | |
| from himena import MainWindow, new_window | |
| def sample_dataframe(): | |
| x = np.linspace(0, np.pi * 2, 100) | |
| return {"x": x, "y": np.cos(x) * np.exp(x / 2)} | |
| def sample_image(): | |
| xx, yy, zz = np.indices((64, 64, 64), dtype=np.float32) | |
| img = np.exp(-((xx - 30) / 30) ** 2 - ((yy - 38) / 22) ** 2 - ((zz - 32) / 35) ** 2) | |
| return img | |
| def main(ui: MainWindow): | |
| ui.add_object(sample_dataframe(), type="dataframe", title="dataframe") | |
| ui.add_object(sample_image(), type="array.image", title="image") | |
| if __name__ == "__main__": | |
| main(new_window()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment