Matthew Turk avatar Matthew Turk committed 9e2e971

Final talk

Comments (0)

Files changed (2)

 %\usepackage{times}
 \usepackage[T1]{fontenc}
 \usepackage{tgadventor}
+\newcommand\smfont{\fontsize{8}{6.4}\selectfont}
 
 \usepackage{graphicx}
 \usepackage{color}
 (such as files) into memory, with semantic information.
 }
 
+\tinysimple{\texttt{hg.yt-project.org/yt/wiki/CodeSupportLevels}}
+
 \begin{frame}[t]{What do we need to know?}
 \begin{itemize}
 \item How is data distributed throughout memory?
 \end{itemize}
 \end{frame}
 
+\begin{frame}[c]
+\begin{center}
+\tiny
+\texttt{hg.yt-project.org/yt/wiki/AddingSupportForANewCode}
+\end{center}
+\end{frame}
+
+\mediumsimple{\texttt{yt/frontends/your\_code}}
+
+\begin{frame}[t, fragile]{Layout of a Frontend}
+\begin{center}
+\smfont{}
+\begin{tabular}{l|p{2.5in}}
+\texttt{fields.py} & Definitions of fields \\[9pt]
+\texttt{data\_structures.py} & Hierarchy, grid, so on \\[9pt]
+\texttt{io.py} & Data loaders \\[9pt]
+\texttt{definitions.py} & Necessary definitions \\[9pt]
+\texttt{misc.py} & Anything else \\[9pt]
+\texttt{api.py} & Imports \\[9pt]
+\texttt{\_\_init\_\_.py} & Empty! \\[9pt]
+\end{tabular}
+\end{center}
+\end{frame}
+
+\mediumsimple{How do I get started?}
+
+\begin{frame}[t]{Flowchart}
+\begin{enumerate}
+\item Start by loading data with \texttt{Stream}
+\item Build up grid objects
+\item Implement IO
+\item Implement hierarchy
+\item Translate fields
+\item Run integration tests
+\end{enumerate}
+\end{frame}
+
 \mediumsimple{How do I load raw data?}
 
 \begin{frame}[fragile, t]
 <<d['scripts/stream_vr.py|fn|pyg|l']>>
 \end{frame}
 
-\fullimage{first_earth.png}
+\fullimage{../first_earth.png}
+
+\mediumsimple{(right now it can get a bit copy pasta, but we're working to
+improve that)}
+
+\begin{frame}[t]{Objects to Implement}
+\begin{center}
+\smfont{}
+\begin{tabular}{l|p{2.5in}}
+Hierarchy & Spatial information for coarse identification \\[9pt]
+Grid patch & Fine-grained identification, and fluid deposition \\[9pt]
+Static Output & Parameters for the file \\[9pt]
+IO Handler & Translate grids or spatial regions to returned data sets \\[9pt]
+Fields & Units, known fields, and so on
+\end{tabular}
+\end{center}
+\end{frame}
+
+\begin{frame}[t]{What about N-body?}
+Several clear steps:
+\begin{itemize}
+\item Identify bounding boxes for particles
+\item (optional) Identify pseudo-AMR levels
+\item Read in by bounding box
+\item (optional) Convert to fluid values
+\end{itemize}
+\end{frame}
 
 \bigsimple{What's next?}
-\mediumsimple{Geometry refactoring.}
-\mediumsimple{Better volume rendering.}
-\mediumsimple{Deeper code integration.}
-\mediumsimple{Fixing broken windows and rusty gates.}
+\mediumsimple{Geometry refactoring}
+\mediumsimple{IO: Grid Data Format}
+\mediumsimple{Better volume rendering}
+\mediumsimple{Deeper code integration}
+\mediumsimple{Fixing \textit{broken windows} and \textit{rusty gates}}
+
+\bigsimple{Community.}
+\bigsimple{}
+\bigsimple{Community.}
 
 \bigsimple{Thank you.}
 
-\bigsimple{Community.}
-
 \end{document}

scripts/stream_load.py

+from yt.mods import *
+import h5py
+import yt.frontends.stream.api as stream
+
+center = na.array([0.5, 0.5, 0.5])
+
+f = h5py.File("spec.h5")
+
+class StreamFieldHandler(object):
+    def __init__(self):
+        self.cached = {}
+
+    def __getitem__(self, key):
+        if field != "Density": raise KeyError
+        return f["/data"][:]
+
+    @property
+    def all_fields(self):
+        return ("Density",)
+
+sfh = StreamFieldHandler()
+
+grid_left_edges = na.array([
+  [0, 0, 0],
+], dtype='int64')
+
+grid_right_edges = na.array([
+  [269, 269, 269],
+], dtype='int64')
+
+domain_dimensions = na.array([269, 269, 269])
+
+domain_left_edge = na.zeros(3, 'float64')
+domain_right_edge = na.ones(3, 'float64')    
+
+grid_levels = na.array([0], dtype='int32').reshape((1,1))
+grid_dimensions = grid_right_edges - grid_left_edges
+
+grid_left_edges  = grid_left_edges.astype("float64")
+grid_left_edges /= domain_dimensions*2**grid_levels
+grid_left_edges *= domain_right_edge - domain_left_edge
+grid_left_edges += domain_left_edge
+
+grid_right_edges  = grid_right_edges.astype("float64")
+grid_right_edges /= domain_dimensions*2**grid_levels
+grid_right_edges *= domain_right_edge - domain_left_edge
+grid_right_edges += domain_left_edge
+
+handler = stream.StreamHandler(
+    grid_left_edges,
+    grid_right_edges,
+    grid_dimensions,
+    grid_levels,
+    na.array([-1], dtype='int64'),
+    na.zeros(1, dtype='int64').reshape((1,1)),
+    na.zeros(1).reshape((1,1)),
+    sfh,
+)
+
+handler.name = "simple_test"
+handler.domain_left_edge = domain_left_edge
+handler.domain_right_edge = domain_right_edge
+handler.refine_by = 2
+handler.dimensionality = 3
+handler.domain_dimensions = domain_dimensions
+handler.simulation_time = 0.0
+handler.cosmology_simulation = 0
+
+spf = stream.StreamStaticOutput(handler)
+spf.units["cm"] = 1.0
+spf.units["unitary"] = 1.0
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.