Confusion about elements of the stalk of the direct image sheaf

$\DeclareMathOperator{\F}{\mathcal{F}}$Let $\F$ be a sheaf on $X$ and $\pi : X \rightarrow Y$ a continuous map. Then the the direct image sheaf $\pi_* \F$ is a sheaf on $Y$. An explicit definition of the stalk the sheaf $\F$ at point $p \in X$ is as follows: $$ \F_p = \{ (f, U) \mid p \in U, \, \, f \in \F(U) \} / \sim $$ where $(f, U) \sim (g, V)$ if and only if there exists an open $W \subset U \cap V$ such that $f|_W = g|_W$. Now, the stalk of $\pi_* \F$ at point $q = \pi(p) \in Y$ is as follows: $$ \begin{align*} (\pi_* \F)_q &= \{ (h, Z) \mid q \in Z, \, \, h \in \pi_* \F(Z) = \F(\pi^{-1}(Z)) \} / \sim \\ &\stackrel{\color{red}{?}}{=} \{ (h, \pi^{-1}(Z)) \mid p \in \pi^{-1}(Z), \, \, h \in \F(\pi^{-1}(Z)) \} / \sim \end{align*} $$ but then since $h \in \F(\pi^{-1}(Z))$, it's e.g. a continuous function in some subset of $X$ (say the sheaves are of continuous functions). Hasn't something gone wrong here? Surely if I'm talking about the stalk of $\pi_* \F$, then shouldn't the function be in $Y$, not $X$? I know that there's a natural map between $(\pi_* \F)_q$ and $\F_p$ so this likely has something do with my question, but all I've done above is write out what the stalk $(\pi_* \F)_q$ is explicitly, and there already seems to be some contradiction regarding the function $h$.

Thank you for any help.


Edit: Having looked at the above, I don't think it's valid me jumping to the second line because this is no longer correct as an explicit realisation of the stalk of $\pi_* \F$, since inside the curly brackets I'm taking sections in $\F$ whereas I should be taking them in $\pi_* \F$.

However I'm still confused; doesn't $f \in \pi_*\F(U)$ mean that $f$ is, say, a continuous function in $Y$ (because $\pi_*\F$ is a sheaf over $Y$), but then simultaneously $f \in \F(\pi^{-1}(U))$ is a continuous function in $X$ because $\F$ is a sheaf over $X$? I feel I'm misunderstanding something really obvious here.

Edit 2: Maybe this isn't relevant. $\F$ being a sheaf on $X$ means its arguments should be open sets in $X$, but it doesn't actually say anything about what the sections have to be?


Let $f:X\to Y$ be a continuous map of topological spaces, let $\mathcal{S}$ be the sheaf of continuous functions on $X$ with values in $\mathbb{K}$ structured as topological space with the natural topology, where $\mathbb{K}$ is either $\mathbb{R}$ (the field of real numbers) or $\mathbb{C}$ (the field of complex numbers).

For exact: \begin{equation} \forall U\subseteq X\,\text{open,}\,\mathcal{S}(U)=\{c:U\to\mathbb{K}\mid c\,\text{is continuous}\}; \end{equation} because $\mathcal{S}$ is a sheaf of rings on $X$, the pair $(X,\mathcal{S})$ is called ringed space.

By definition: \begin{equation} \forall V\subseteq Y\,\text{open,}\,f_{*}\mathcal{S}(V)\stackrel{def.}{=}\mathcal{S}(f^{-1}(V)), \end{equation} that is: $f_{*}\mathcal{S}$ is a sheaf of rings on $Y$; the elements of $f_{*}\mathcal{S}(V)$ can be identified with functions on $V$, with values in $\mathbb{K}$ which admit a factorization via $f$. In other words, $f_{*}\mathcal{S}$ is a subsheaf of the sheaf of functions on $Y$ with values in $\mathbb{K}$.

Remark. For clarity: \begin{equation} \forall V\subseteq Y\,\text{open,}\,f_{*}\mathcal{S}(V)=\{d:V\to\mathbb{K}\mid\exists c\in\mathcal{S}(f^{-1}(V))\,\text{with}\,d=c\circ f\}, \end{equation} and one can not state that $d$ is continuous on $V$. $\Diamond$

Let \begin{equation} \widetilde{X}=X_{\displaystyle/(x\sim y\iff f(x)=f(y))}, \end{equation} that is $\widetilde{X}$ is the quotient set of $X$ where the points with the same image via $f$ are identied; let $\pi:X\to\widetilde{X}$ be the canonical projection, and let $\varphi:\widetilde{X}\to Y$ be the unique function such that \begin{equation} f=\varphi\circ\pi. \end{equation} One knows that $\varphi$ is an injective map; considering on $\widetilde{X}$ the quotient topology, one has that $\pi$ and $\varphi$ are continuous maps and \begin{equation} f_{*}\mathcal{S}=(\varphi\circ\pi)_{*}\mathcal{S}=\varphi_{*}\left(\pi_{*}\mathcal{S}\right). \end{equation} Because $f(X)=\varphi\left(\widetilde{X}\right)=Z$ is a subset of $Y$ and $\varphi$ is injective, one knows that: \begin{equation} \forall y\in Y,\,\left(f_{*}\mathcal{S}\right)_y=\begin{cases} 0\iff y\notin\overline{Z}\\ \left(\pi_{*}\mathcal{S}\right)_z\iff\varphi(z)=y\in Z\\ ?\iff y\in\overline{Z}\setminus Z \end{cases}. \end{equation} Example. Let \begin{equation} X=\{a,b,c\},\,\mathcal{T}=\{\emptyset,\{b\},\{c\},\{b,c\},X\}; \end{equation} $\{a\}$ is a closed point and $\{b\}$ is an open point of $X$. Let \begin{equation} \mathcal{F}(\emptyset)=\{0\},\,\mathcal{F}(\{b\})=\mathbb{Z}, \end{equation} this is a sheaf on $\{b\}$ with the topology of subspace of $(X,\mathcal{T})$; easily one has: \begin{equation} i_{*}\mathcal{F}(X)=\mathbb{Z}\Rightarrow\left(i_{*}\mathcal{F}\right)_a=\mathbb{Z},\\ \left(i_{*}\mathcal{F}\right)_b=\mathbb{Z},\\ i_{*}\mathcal{F}(\{c\})=\{0\},i_{*}\mathcal{F}(\{b,c\})=\mathbb{Z}\Rightarrow\left(i_{*}\mathcal{F}\right)_c=\{0\} \end{equation} where $i:\{b\}\hookrightarrow X$ is the inclusion and $a\in\overline{\{b\}}\setminus\{b\}$. Instead, let $\mathcal{G}$ be the analogous sheaf on $\{a\}$; one has that $j_{*}\mathcal{G}$ is the skyscraper sheaf on $X$ with stalk $\mathbb{Z}$ at $a$, where $j:\{a\}\to X$ is the inclusion. $\triangle$

So, also if one computes what is $\left(\pi_{*}\mathcal{S}\right)_z$ for any $z\in\widetilde{X}$, in general one can state nothing about $\left(f_{*}\mathcal{S}\right)_y$ for $y\in\overline{Z}\setminus Z$ a priori.