summarylogtreecommitdiffstats
path: root/doc-use-local-data.patch
diff options
context:
space:
mode:
authorUniversebenzene2023-04-29 19:07:27 +0800
committerUniversebenzene2023-04-29 19:07:27 +0800
commit213dc82cbb41b75af0ad13a57d04cbf6d04cf823 (patch)
tree562f2a1128015774f3d421f6f19c9dad73c9f715 /doc-use-local-data.patch
parent1645a958e985d4e7e2f98fb05714588b4afe6417 (diff)
downloadaur-213dc82cbb41b75af0ad13a57d04cbf6d04cf823.tar.gz
Update to version 2.10.0
Diffstat (limited to 'doc-use-local-data.patch')
-rw-r--r--doc-use-local-data.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/doc-use-local-data.patch b/doc-use-local-data.patch
new file mode 100644
index 000000000000..ac1a6606dbea
--- /dev/null
+++ b/doc-use-local-data.patch
@@ -0,0 +1,25 @@
+--- a/docs/_examples/plot_custom_source.py 2023-04-27 23:07:04.000000000 +0800
++++ b/docs/_examples/plot_custom_source.py 2023-04-29 18:24:35.212710056 +0800
+@@ -65,11 +65,18 @@
+ # sncosmo to download the Nugent Ia and 2p templates. Don't rely on this
+ # the `DATADIR` object, or these paths in your code though, as these are
+ # subject to change between version of sncosmo!
++# Use local data if download failed:
+ from sncosmo.builtins import DATADIR
+-phase1, wave1, flux1 = sncosmo.read_griddata_ascii(
+- DATADIR.abspath('models/nugent/sn1a_flux.v1.2.dat'))
+-phase2, wave2, flux2 = sncosmo.read_griddata_ascii(
+- DATADIR.abspath('models/nugent/sn2p_flux.v1.2.dat'))
++try:
++ phase1, wave1, flux1 = sncosmo.read_griddata_ascii(
++ DATADIR.abspath('models/nugent/sn1a_flux.v1.2.dat'))
++except Exception:
++ phase1, wave1, flux1 = sncosmo.read_griddata_ascii('sn1a_flux.v1.2.dat')
++try:
++ phase2, wave2, flux2 = sncosmo.read_griddata_ascii(
++ DATADIR.abspath('models/nugent/sn2p_flux.v1.2.dat'))
++except Exception:
++ phase2, wave2, flux2 = sncosmo.read_griddata_ascii('sn2p_flux.v1.2.dat')
+
+ # In our __init__ method we defined above, the two fluxes need to be on
+ # the same grid, so interpolate the second onto the first: