Skip to content

Commit

Permalink
Merge pull request #10 from cryoem-uoft/release-v4.1
Browse files Browse the repository at this point in the history
Release v4.1.1
  • Loading branch information
nfrasser authored Dec 21, 2022
2 parents 5a335b6 + a90631e commit 109c877
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v4.1.1

- Use correct numpy object type for newer versions of Numpy
- Fix limit on number of active datasets
- Use correct C types in Cython header definition

## v4.1.0

- Initial release
Expand Down
2 changes: 1 addition & 1 deletion cryosparc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "4.1.0"
__version__ = "4.1.1"


def get_include():
Expand Down
21 changes: 11 additions & 10 deletions cryosparc/dataset.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ctypedef Py_ssize_t Dset
from libc.stdint cimport uint64_t, uint32_t
ctypedef uint64_t Dset

cdef extern from "cryosparc-tools/dataset.h":

Expand All @@ -7,18 +8,18 @@ cdef extern from "cryosparc-tools/dataset.h":
Dset dset_innerjoin(const char *key, Dset dset_r, Dset dset_s) nogil
void dset_del(Dset dset) nogil

Py_ssize_t dset_totalsz(Dset dset) nogil
long dset_ncol(Dset dset) nogil
Py_ssize_t dset_nrow(Dset dset) nogil
const char *dset_key(Dset dset, Py_ssize_t index) nogil
uint64_t dset_totalsz(Dset dset) nogil
uint32_t dset_ncol(Dset dset) nogil
uint64_t dset_nrow(Dset dset) nogil
const char *dset_key(Dset dset, uint64_t index) nogil
int dset_type(Dset dset, const char *colkey) nogil
void *dset_get(Dset dset, const char *colkey) nogil
Py_ssize_t dset_getsz(Dset dset, const char *colkey) nogil
bint dset_setstr(Dset dset, const char *colkey, Py_ssize_t index, const char *value) nogil
const char *dset_getstr(Dset dset, const char *colkey, Py_ssize_t index) nogil
long dset_getshp(Dset dset, const char *colkey) nogil
uint64_t dset_getsz(Dset dset, const char *colkey) nogil
bint dset_setstr(Dset dset, const char *colkey, uint64_t index, const char *value) nogil
const char *dset_getstr(Dset dset, const char *colkey, uint64_t index) nogil
uint32_t dset_getshp(Dset dset, const char *colkey) nogil

bint dset_addrows(Dset dset, long num) nogil
bint dset_addrows(Dset dset, uint32_t num) nogil
bint dset_addcol_scalar(Dset dset, const char *key, int type) nogil
bint dset_addcol_array(Dset dset, const char *key, int type, int shape0, int shape1, int shape2) nogil
bint dset_changecol(Dset dset, const char *key, int type) nogil
Expand Down
2 changes: 1 addition & 1 deletion cryosparc/dtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DatasetHeader(TypedDict):
DsetType.T_U32: n.uint32,
DsetType.T_STR: n.uint64, # Note: Prefer T_OBJ when working in Python
DsetType.T_U64: n.uint64,
DsetType.T_OBJ: n.object0,
DsetType.T_OBJ: n.object_,
}

TYPE_TO_DSET_MAP = {
Expand Down
2 changes: 1 addition & 1 deletion cryosparc/include/cryosparc-tools/dataset.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ moreslots (void) {
}

#define SHIFT_GEN (64-15)
#define MASK_IDX (0xffffffffffffffff >> SHIFT_GEN)
#define MASK_IDX (0xffffffffffffffff >> 15)

static inline uint64_t
roundup(uint64_t value, uint64_t to)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cryosparc-tools"
version = "4.1.0"
version = "4.1.1"
description = "Toolkit for interfacing with CryoSPARC"
readme = "README.md"
requires-python = ">=3.7"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

setup(
name="cryosparc_tools",
version="4.1.0",
version="4.1.1",
description="Toolkit for interfacing with CryoSPARC",
headers=["cryosparc/include/cryosparc-tools/dataset.h"],
ext_modules=cythonize(
Expand Down
10 changes: 10 additions & 0 deletions tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,13 @@ def test_append_many_empty():

def test_union_many_empty():
assert len(Dataset.union_many().rows()) == 0


def test_allocate_many():
# Checks for logic issues when allocating a lot of datasets
for _ in range(3):
allocated = []
for _ in range(33_000):
allocated.append(Dataset(1))
assert len(allocated) == 33_000
del allocated

1 comment on commit 109c877

@vercel
Copy link

@vercel vercel bot commented on 109c877 Dec 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.