Skip to content

Commit bb3aced

Browse files
authored
Merge pull request #94 from alan-turing-institute/dev
For 0.7.2 release
2 parents 67cbae6 + c997016 commit bb3aced

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ScientificTypes"
22
uuid = "321657f4-b219-11e9-178b-2701a2544e81"
33
authors = ["Anthony D. Blaom <[email protected]>"]
4-
version = "0.7.1"
4+
version = "0.7.2"
55

66
[compat]
77
julia = "1"

README.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,45 @@ places on the actual machine type of the data supplied.
5151

5252
#### 1. Scientific types
5353

54-
ScientificTypes provides a hierarchy of Julia types
55-
representing data types for use in method dispatch (e.g., for trait
56-
values). Instances of the types play no role.
54+
ScientificTypes provides new julia types signifying "scientific type"
55+
for use in method dispatch (e.g., for trait values). Instances of the
56+
types play no role.
5757

5858
```
59-
Found
60-
├─ Known
61-
│ ├─ Finite
62-
│ │ ├─ Multiclass
63-
│ │ └─ OrderedFactor
64-
│ ├─ Infinite
65-
│ │ ├─ Continuous
66-
│ │ └─ Count
67-
│ ├─ Image
68-
│ │ ├─ ColorImage
69-
│ │ └─ GrayImage
70-
│ ├─ Table
71-
│ └─ Textual
72-
└─ Unknown
59+
Finite{N}
60+
├─ Multiclass{N}
61+
└─ OrderedFactor{N}
62+
63+
Infinite
64+
├─ Continuous
65+
└─ Count
66+
67+
Image{W,H}
68+
├─ ColorImage{W,H}
69+
└─ GrayImage{W,H}
70+
71+
Time
72+
├─ Day
73+
└─ Instant
74+
75+
Table{K}
76+
77+
Textual
78+
79+
Unknown
7380
```
7481

7582
The types `Finite{N}`, `Multiclass{N}` and `OrderedFactor{N}` are all
7683
parametrised by the number of levels `N`, while `Image{W,H}`,
7784
`GrayImage{W,H}` and `ColorImage{W,H}` are all parametrised by the
7885
image width and height dimensions, `(W, H)`.
7986

80-
The `Table` type also has a type parameter, for conveying the
81-
scientific type(s) of table columns. See [More on the `Table`
87+
The `Day` type is intended for dates (respresented, for example, by
88+
julia's `Date.Date` type) while `Instant` is intended for finer
89+
measurements of time (such as those represented by Date.DateTime`).
90+
91+
The type parameter `K` in `Table{K}` is for conveying the scientific
92+
type(s) of a table's columns. See [More on the `Table`
8293
type](#more-on-the-table-type).
8394

8495
The julia native `Missing` type is also regarded as a scientific

src/ScientificTypes.jl

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,16 @@ export Convention
55

66
# re-export-able types and methods
77
export Scientific, Found, Unknown, Known, Finite, Infinite,
8-
OrderedFactor, Multiclass, Count, Continuous, Textual,
9-
Binary, ColorImage, GrayImage, Image, Table
8+
OrderedFactor, Multiclass, Count, Continuous,
9+
Time, Day, Instant, Textual, Binary,
10+
ColorImage, GrayImage, Image, Table
1011
export scitype, scitype_union, elscitype, nonmissing, trait
1112

1213
# utils (should not be re-exported)
1314
export TRAIT_FUNCTION_GIVEN_NAME, set_convention
1415

1516
# -------------------------------------------------------------------
1617
# Scientific Types
17-
#
18-
# Found
19-
# ├─ Known
20-
# │ ├─ Finite
21-
# │ │ ├─ Multiclass
22-
# │ │ └─ OrderedFactor
23-
# │ ├─ Infinite
24-
# │ │ ├─ Continuous
25-
# │ │ └─ Count
26-
# │ ├─ Image
27-
# │ │ ├─ ColorImage
28-
# │ │ └─ GrayImage
29-
# │ └─ Textual
30-
# └─ Unknown
31-
#
3218

3319
abstract type Found end
3420
abstract type Known <: Found end
@@ -37,6 +23,7 @@ struct Unknown <: Found end
3723
abstract type Infinite <: Known end
3824
abstract type Finite{N} <: Known end
3925
abstract type Image{W,H} <: Known end
26+
abstract type Time <: Known end
4027
struct Textual <: Known end
4128
struct Table{K} <: Known end
4229

@@ -46,6 +33,9 @@ struct Count <: Infinite end
4633
struct Multiclass{N} <: Finite{N} end
4734
struct OrderedFactor{N} <: Finite{N} end
4835

36+
struct Day <: Time end
37+
struct Instant <: Time end
38+
4939
struct GrayImage{W,H} <: Image{W,H} end
5040
struct ColorImage{W,H} <: Image{W,H} end
5141

0 commit comments

Comments
 (0)