Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #110

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ repos:
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.2
rev: v0.6.4
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.17.0
hooks:
- id: pyupgrade
args: [ --py36-plus ]
15 changes: 8 additions & 7 deletions docs/jupyter_examples/astronomy_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(0, '../../') # add iniabu to python path from this repo\n",
"\n",
"sys.path.insert(0, \"../../\") # add iniabu to python path from this repo\n",
"\n",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -108,9 +109,9 @@
"ydata = inimf.ele_bracket(\"Ba\", \"H\", ba_obs / h_obs)\n",
"\n",
"# Make the plot\n",
"plt.plot(xdata, ydata, 'o')\n",
"plt.xlabel('[Fe/H]')\n",
"plt.ylabel('[Ba/H]')\n",
"plt.plot(xdata, ydata, \"o\")\n",
"plt.xlabel(\"[Fe/H]\")\n",
"plt.ylabel(\"[Ba/H]\")\n",
"plt.show()"
]
},
Expand Down Expand Up @@ -172,9 +173,9 @@
"eles = inimf.ele[list(ele_names)]\n",
"\n",
"# now plot the elemet mass vs. the logarithmic abundance:\n",
"plt.plot(eles.mass, eles.abu_solar, ':o', ms=4)\n",
"plt.xlabel('Mass number')\n",
"plt.ylabel('Logarithmic abundance ([H] = 12)')"
"plt.plot(eles.mass, eles.abu_solar, \":o\", ms=4)\n",
"plt.xlabel(\"Mass number\")\n",
"plt.ylabel(\"Logarithmic abundance ([H] = 12)\")"
]
},
{
Expand Down
25 changes: 15 additions & 10 deletions docs/jupyter_examples/cosmochemistry_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(0, '../../') # add iniabu to python path from this repo\n",
"\n",
"sys.path.insert(0, \"../../\") # add iniabu to python path from this repo\n",
"\n",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -49,8 +50,8 @@
"# create a list with all \"signals\", our measurements. T\n",
"measurements = []\n",
"for abu in fe_isos.abu_solar:\n",
" measurements.append(abu + np.random.randn(num_samples) * abu / 100.)\n",
" \n",
" measurements.append(abu + np.random.randn(num_samples) * abu / 100.0)\n",
"\n",
"# now linearly fractionate the mneasurements mass dependently by 1% per amu\n",
"for it, msr in enumerate(measurements):\n",
" measurements[it] = (1 + (fe_isos.mass[it] - fe_isos.mass[0]) * 0.01) * msr\n",
Expand Down Expand Up @@ -97,11 +98,11 @@
"xdata = fe_isos.mass\n",
"for it in range(num_samples):\n",
" ydata = [delta[it] for delta in deltas]\n",
" ax.plot(xdata, ydata, '-o')\n",
" ax.plot(xdata, ydata, \"-o\")\n",
"\n",
"# make the plot a bit nicer\n",
"xlim = (53.5, 58.5)\n",
"plt.hlines(0, xlim[0], xlim[1], color='k', linewidth=0.5, linestyle='dashed')\n",
"plt.hlines(0, xlim[0], xlim[1], color=\"k\", linewidth=0.5, linestyle=\"dashed\")\n",
"ax.set_xlim(53.5, 58.5)\n",
"ax.set_xticks(fe_isos.mass)\n",
"ax.set_xticklabels(fe_isos.name)\n",
Expand Down Expand Up @@ -153,9 +154,13 @@
"for it, msr in enumerate(measurements):\n",
" Deltas_int.append(\n",
" ini.iso_int_norm(\n",
" fe_isos.name[it], (\"Fe-56\", \"Fe-54\"), msr, (measurements[1], measurements[0]),\n",
" delta_factor=1000, law=\"lin\"\n",
" )\n",
" fe_isos.name[it],\n",
" (\"Fe-56\", \"Fe-54\"),\n",
" msr,\n",
" (measurements[1], measurements[0]),\n",
" delta_factor=1000,\n",
" law=\"lin\",\n",
" )\n",
" )\n",
"\n",
"\n",
Expand All @@ -165,11 +170,11 @@
"xdata = fe_isos.mass\n",
"for it in range(num_samples):\n",
" ydata = [Delta[it] for Delta in Deltas_int]\n",
" ax.plot(xdata, ydata, '-o')\n",
" ax.plot(xdata, ydata, \"-o\")\n",
"\n",
"# make the plot a bit nicer\n",
"xlim = (53.5, 58.5)\n",
"plt.hlines(0, xlim[0], xlim[1], color='k', linewidth=0.5, linestyle='dashed')\n",
"plt.hlines(0, xlim[0], xlim[1], color=\"k\", linewidth=0.5, linestyle=\"dashed\")\n",
"ax.set_xlim(53.5, 58.5)\n",
"ax.set_xticks(fe_isos.mass)\n",
"ax.set_xticklabels(fe_isos.name)\n",
Expand Down
13 changes: 7 additions & 6 deletions docs/jupyter_examples/introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(0, '../../') # add iniabu to python path from this repo\n",
"\n",
"sys.path.insert(0, \"../../\") # add iniabu to python path from this repo\n",
"\n",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -422,9 +423,9 @@
"# make the figure and axis\n",
"fig, ax = plt.subplots(1, 1)\n",
"eles = ini.ele[list(ele_names)] # needs to be passed as a list, not dictionary keys!\n",
"ax.semilogy(eles.mass, eles.abu_solar, ':o', ms=4)\n",
"ax.set_xlabel('Mass')\n",
"ax.set_ylabel('Solar abundance')"
"ax.semilogy(eles.mass, eles.abu_solar, \":o\", ms=4)\n",
"ax.set_xlabel(\"Mass\")\n",
"ax.set_ylabel(\"Solar abundance\")"
]
},
{
Expand Down Expand Up @@ -472,11 +473,11 @@
"# loop to make all the subplots\n",
"for it, ele in enumerate(eles):\n",
" iso = ini.iso[ele]\n",
" ax[it].bar(iso.mass, iso.abu_rel*100, width=0.5)\n",
" ax[it].bar(iso.mass, iso.abu_rel * 100, width=0.5)\n",
" ax[it].set_xlabel(\"Mass\")\n",
" ax[it].set_title(ele)\n",
"\n",
"# y-label only for first \n",
"# y-label only for first\n",
"ax[0].set_ylabel(\"Relative abundance (%)\")"
]
},
Expand Down
Loading