Skip to content

Commit

Permalink
Merge pull request yt-project#3913 from neutrinoceros/manual_bp_yt4.0.4
Browse files Browse the repository at this point in the history
REL: backports for yt 4.0.4
  • Loading branch information
matthewturk authored May 16, 2022
2 parents d4a45eb + 8231659 commit 5b9fe93
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 28 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- stable
tags:
- 'yt-*'
pull_request:
paths:
- '.github/workflows/wheels.yaml'
workflow_dispatch:

jobs:
Expand All @@ -29,14 +32,14 @@ jobs:
- uses: actions/checkout@v2

- name: Build wheels for CPython
uses: pypa/cibuildwheel@v2.3.0
uses: pypa/cibuildwheel@v2.4.0
with:
output-dir: dist
env:
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-* cp310-*"
CIBW_SKIP: "*-musllinux_*" # numpy doesn't have wheels for musllinux so we can't build some quickly and without bloating
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "x86_64"
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_WINDOWS: "auto"
CIBW_ENVIRONMENT: "LDFLAGS='-static-libstdc++'"
CIBW_BUILD_VERBOSITY: 1
Expand Down
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
# built documents.
#
# The short X.Y version.
version = "4.0.3"
version = "4.0"
# The full version, including alpha/beta/rc tags.
release = "4.0.3"
release = "4.0.4"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = yt
version = 4.0.3
version = 4.0.4
description = An analysis and visualization toolkit for volumetric data
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

install_ccompiler()

VERSION = "4.0.3"

if os.path.exists("MANIFEST"):
os.remove("MANIFEST")

Expand Down
2 changes: 1 addition & 1 deletion tests/ci_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if [[ "${RUNNER_OS}" == "Windows" ]] && [[ ${dependencies} != "minimal" ]]; then
# keep in sync: setup.cfg
while read requirement; do conda install --yes $requirement; done < tests/windows_conda_requirements.txt
else
python -m pip install --upgrade pip
python -m pip install --upgrade "pip != 22.1"
python -m pip install --upgrade wheel

# // band aid
Expand Down
2 changes: 1 addition & 1 deletion yt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Contribute: https://github.com/yt-project/yt
"""
__version__ = "4.0.3"
__version__ = "4.0.4"

import yt.units as units
import yt.utilities.physical_constants as physical_constants
Expand Down
10 changes: 9 additions & 1 deletion yt/frontends/gadget/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,15 @@ def _parse_parameter_file(self):
)

if hvals["NumFiles"] > 1:
self.filename_template = f"{prefix}.%(num)s{self._suffix}"
for t in (
f"{prefix}.%(num)s{self._suffix}",
f"{prefix}.gad.%(num)s{self._suffix}",
):
if os.path.isfile(t % {"num": 0}):
self.filename_template = t
break
else:
raise RuntimeError("Could not determine correct data file template.")
else:
self.filename_template = self.parameter_filename

Expand Down
3 changes: 2 additions & 1 deletion yt/geometry/particle_geometry_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ def _setup_filenames(self):
mylog.warning(
"Failed to load '%s' (missing file or directory)", _filename
)
break
if max(df.total_particles.values()) == 0:
break
fi += 1
self.data_files.append(df)
if self.chunksize <= 0:
if end is None:
break
start = end
end += self.chunksize
Expand Down
3 changes: 1 addition & 2 deletions yt/utilities/lib/geometry_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import numpy as np
cimport cython
cimport numpy as np
from cython cimport floating
from libc.math cimport copysign, fabs
from libc.math cimport copysign, fabs, log2
from libc.stdlib cimport free, malloc

from yt.utilities.lib.fp_utils cimport fclip, i64clip
Expand All @@ -40,7 +40,6 @@ cdef extern from "math.h":
double fabs(double x) nogil

cdef extern from "platform_dep.h":
double log2(double x) nogil
long int lrint(double x) nogil

@cython.cdivision(True)
Expand Down
3 changes: 0 additions & 3 deletions yt/utilities/lib/platform_dep.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ static __inline double fmax(double x, double y){
static __inline double fmin(double x, double y){
return (x < y) ? x : y;
}
static __inline double log2(double x) {
return log(x) * M_LOG2E;
}

/* adapted from http://www.johndcook.com/blog/cpp_erf/
code is under public domain license */
Expand Down
23 changes: 11 additions & 12 deletions yt/visualization/color_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from packaging.version import Version

from yt.funcs import get_brewer_cmap
from yt.utilities.logger import ytLogger as mylog

from . import _colormap_data as _cm
from ._commons import MPL_VERSION
Expand Down Expand Up @@ -76,8 +77,6 @@ def register_yt_colormaps_from_cmyt():
"""
from matplotlib.pyplot import get_cmap

from yt.utilities.logger import ytLogger as mylog

for hist_name, alias in _HISTORICAL_ALIASES.items():
if MPL_VERSION >= Version("3.4.0"):
cmap = get_cmap(alias).copy()
Expand All @@ -91,25 +90,25 @@ def register_yt_colormaps_from_cmyt():
# Matplotlib 3.4.0 hard-forbids name collisions, but more recent versions
# will emit a warning instead, so we emulate this behaviour regardless.
mylog.warning("cannot register colormap '%s' (naming collision)", hist_name)
continue


register_yt_colormaps_from_cmyt()

# Add colormaps in _colormap_data.py that weren't defined here
_vs = np.linspace(0, 1, 256)
for k, v in list(_cm.color_map_luts.items()):
if k in yt_colormaps:
continue
cdict = {
"red": np.transpose([_vs, v[0], v[0]]),
"green": np.transpose([_vs, v[1], v[1]]),
"blue": np.transpose([_vs, v[2], v[2]]),
}
try:
colormaps = mcm._cmap_registry
except AttributeError: # mpl < 3.3.0
colormaps = mcm.cmap_d
if k not in yt_colormaps and k not in colormaps:
cdict = {
"red": np.transpose([_vs, v[0], v[0]]),
"green": np.transpose([_vs, v[1], v[1]]),
"blue": np.transpose([_vs, v[2], v[2]]),
}
add_colormap(k, cdict)
except ValueError:
# expected if another map with identical name was already registered
mylog.warning("cannot register colormap '%s' (naming collision)", k)


def get_colormap_lut(cmap_id: Union[Tuple[str, str], str]):
Expand Down

0 comments on commit 5b9fe93

Please # to comment.