Skip to content

Commit

Permalink
Merge pull request #94 from alan-turing-institute/dev
Browse files Browse the repository at this point in the history
For 0.7.2 release
  • Loading branch information
ablaom authored Mar 5, 2020
2 parents 67cbae6 + c997016 commit bb3aced
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ScientificTypes"
uuid = "321657f4-b219-11e9-178b-2701a2544e81"
authors = ["Anthony D. Blaom <anthony.blaom@gmail.com>"]
version = "0.7.1"
version = "0.7.2"

[compat]
julia = "1"
Expand Down
49 changes: 30 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,45 @@ places on the actual machine type of the data supplied.

#### 1. Scientific types

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

```
Found
├─ Known
│ ├─ Finite
│ │ ├─ Multiclass
│ │ └─ OrderedFactor
│ ├─ Infinite
│ │ ├─ Continuous
│ │ └─ Count
│ ├─ Image
│ │ ├─ ColorImage
│ │ └─ GrayImage
│ ├─ Table
│ └─ Textual
└─ Unknown
Finite{N}
├─ Multiclass{N}
└─ OrderedFactor{N}
Infinite
├─ Continuous
└─ Count
Image{W,H}
├─ ColorImage{W,H}
└─ GrayImage{W,H}
Time
├─ Day
└─ Instant
Table{K}
Textual
Unknown
```

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

The `Table` type also has a type parameter, for conveying the
scientific type(s) of table columns. See [More on the `Table`
The `Day` type is intended for dates (respresented, for example, by
julia's `Date.Date` type) while `Instant` is intended for finer
measurements of time (such as those represented by Date.DateTime`).

The type parameter `K` in `Table{K}` is for conveying the scientific
type(s) of a table's columns. See [More on the `Table`
type](#more-on-the-table-type).

The julia native `Missing` type is also regarded as a scientific
Expand Down
24 changes: 7 additions & 17 deletions src/ScientificTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,16 @@ export Convention

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

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

# -------------------------------------------------------------------
# Scientific Types
#
# Found
# ├─ Known
# │ ├─ Finite
# │ │ ├─ Multiclass
# │ │ └─ OrderedFactor
# │ ├─ Infinite
# │ │ ├─ Continuous
# │ │ └─ Count
# │ ├─ Image
# │ │ ├─ ColorImage
# │ │ └─ GrayImage
# │ └─ Textual
# └─ Unknown
#

abstract type Found end
abstract type Known <: Found end
Expand All @@ -37,6 +23,7 @@ struct Unknown <: Found end
abstract type Infinite <: Known end
abstract type Finite{N} <: Known end
abstract type Image{W,H} <: Known end
abstract type Time <: Known end
struct Textual <: Known end
struct Table{K} <: Known end

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

struct Day <: Time end
struct Instant <: Time end

struct GrayImage{W,H} <: Image{W,H} end
struct ColorImage{W,H} <: Image{W,H} end

Expand Down

0 comments on commit bb3aced

Please sign in to comment.