Skip to content

Commit

Permalink
Better magnitudes, ignoring dot files
Browse files Browse the repository at this point in the history
  • Loading branch information
sesquideus committed Nov 27, 2024
1 parent 7bc9f56 commit 5de9eb8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
17 changes: 9 additions & 8 deletions core/latex/math.tex
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,20 @@
\NewDocumentCommand{\Eval}{m m O{}}{\left.#1\right|_{#2}^{#3}}
\NewDocumentCommand{\EvalP}{m m O{}}{\left(#1\right)_{#2}^{#3}}
\NewDocumentCommand{\EvalB}{m m O{}}{\left[#1\right]_{#2}^{#3}}
% Expected value

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% STATISTICS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Distribution #1 of variable #2 with parameters #3
\NewDocumentCommand{\Distribution}{m m m}{#1\left(#2 \mid #3\right)}

% Statistics
\NewDocumentCommand{\ExpectedChevrons}{m}{\left<#1\right>}
\NewDocumentCommand{\ExpectedE}{m}{\mathrm{E}\left[#1\right]}
\NewDocumentCommand{\Mean}{m}{\overline{#1}}
\NewDocumentCommand{\Var}{m}{\mathrm{Var}\left(#1\right)}
\NewDocumentCommand{\MSE}{m}{\mathrm{MSE}\left({#1}\right)}
\NewDocumentCommand{\Bias}{m}{\mathrm{Bias}\left({#1}\right)}
\NewDocumentCommand{\Binomial}{m m}{\binom {#1} {#2}}

% Text with spaces on both sides
\NewDocumentCommand{\QText}{m}{\quad\text{#1}\quad}
Expand Down Expand Up @@ -350,12 +357,6 @@

\NewDocumentCommand{\Angle}{}{\sphericalangle}

% Astronomical magnitudes
\NewDocumentCommand{\Mag}{m}{\ensuremath{{#1}^{\mathrm{m}}}}

% Distribution #1 of variable #2 with parameters #3
\NewDocumentCommand{\Distribution}{m m m}{#1\left(#2 \mid #3\right)}

% Asymptotic notations
\NewDocumentCommand{\SmallO}{m}{\mathcal{o}\left(#1\right)}
\NewDocumentCommand{\BigO}{m}{\mathcal{O}\left(#1\right)}
Expand Down Expand Up @@ -395,8 +396,8 @@

\NewDocumentCommand{\kth}{m}{\ensuremath{#1^{\text{th}}}}

% Defaults for multi-notation
\NewDocumentCommand{\Expected}{m}{\ExpectedE{#1}}
\NewDocumentCommand{\Binomial}{m m}{\binom {#1} {#2}}

\let\tmp\phi
\let\phi\varphi
Expand Down
4 changes: 3 additions & 1 deletion core/latex/siunitx.tex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
\DeclareSIUnit{\parsec}{pc}
\DeclareSIUnit{\lightyear}{ly}
\DeclareSIUnit{\watthour}{Wh}
\DeclareSIUnit{\mag}{\!\ensuremath{^\mathrm{m}}}
\DeclareSIUnit{\upmag}{\kern-0.25em\ensuremath{^\mathrm{m}}}
\DeclareSIUnit{\mag}{mag}
\DeclareSIUnit{\rpm}{rpm}
\DeclareSIUnit{\textarcsecond}{as}
\DeclareSIUnit{\solarmass}{\ensuremath{\mathrm{M}_\Sun}}
\DeclareSIUnit{\solarluminosity}{\ensuremath{\mathrm{L}_\Sun}}
Expand Down
8 changes: 5 additions & 3 deletions core/utilities/crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def __init__(self, root):

@staticmethod
def is_node(path):
return path.is_dir() and path.name != '.' and Path(path, 'meta.yaml').is_file()
return path.is_dir() and path.basename[0] != '.' and Path(path, 'meta.yaml').is_file()

@staticmethod
def is_leaf(path):
return path.is_file()
return path.is_file() and path.basename[0] != '.'

def print_path(self, path=None, offset=0):
if path is None:
Expand All @@ -32,6 +32,7 @@ def print_path(self, path=None, offset=0):
colour = c.meta if path.name == 'meta.yaml' else c.leaf

print(f"{' ' * offset * self.step}{colour(path.name)}")

if self.is_node(path):
for child in sorted(path.iterdir()):
self.print_path(child, offset + 1)
Expand All @@ -40,7 +41,8 @@ def children(self):
return [child.name for child in sorted(self.root.iterdir()) if self.is_node(child)]

def subdirs(self):
return [child.name for child in sorted(self.root.iterdir()) if child.is_dir()]
""" DeGeŠ should ignore all directories starting with '.' """
return [child.name for child in sorted(self.root.iterdir()) if child.is_dir() and not child.name.startswith('.')]

def __str__(self):
return f"Crawler at {self.root}"

0 comments on commit 5de9eb8

Please sign in to comment.