-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0530778
commit a22aa14
Showing
4 changed files
with
111 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script> | ||
export let valid; | ||
</script> | ||
|
||
{#if valid} | ||
<div class="valid">✓</div> | ||
{:else} | ||
<div class="invalid">×</div> | ||
{/if} | ||
|
||
<style> | ||
.invalid, | ||
.valid { | ||
border-radius: 50%; | ||
padding: 10px; | ||
margin: 10px auto; | ||
color: white; | ||
width: 100px; | ||
height: 100px; | ||
font-size: 50px; | ||
text-align: center; | ||
padding: 15px; | ||
} | ||
.invalid { | ||
background-color: red; | ||
border: solid red 1px; | ||
} | ||
.valid { | ||
background-color: green; | ||
border: solid green 1px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<script> | ||
import { getJson } from "../../utils"; | ||
import CheckMark from "../../CheckMark.svelte"; | ||
export let source; | ||
export let multiscale; | ||
// We check that all multiscale Datasets have same dtype and | ||
// shape.length (number of dimensions) | ||
// If multiscale.axes (version > 0.3) check it matches shape | ||
const datasets = multiscale.datasets; | ||
const axes = multiscale.axes; | ||
function allEqual(items) { | ||
return items.every((value) => value == items[0]); | ||
} | ||
async function loadAndValidate() { | ||
let dtypes = []; | ||
let dimCounts = []; | ||
let shapes = []; | ||
for (let i = 0; i < datasets.length; i++) { | ||
let dataset = datasets[i]; | ||
let zarray = await getJson(source + dataset.path + "/.zarray"); | ||
dimCounts.push(zarray.shape.length); | ||
dtypes.push(zarray.dtype); | ||
shapes.push(zarray.shape); | ||
} | ||
let errors = []; | ||
if (dtypes.length === 0) { | ||
errors.push("No multiscale datasets") | ||
} | ||
if (!allEqual(dtypes)) { | ||
errors.push(`dtypes mismatch: ${dtypes.join(", ")}`) | ||
} | ||
if (!allEqual(dimCounts)) { | ||
errors.push(`number of dimensions mismatch: ${dimCounts.join(", ")}`) | ||
} | ||
if (axes) { | ||
shapes.forEach((shape) => { | ||
if (shape.length != axes.length) { | ||
errors.push(`Shape (${shape.join(", ")}) doesn't match axes length: ${axes.length}`) | ||
} | ||
}); | ||
} | ||
return errors; | ||
} | ||
const promise = loadAndValidate(); | ||
</script> | ||
|
||
{#await promise} | ||
<p>loading...</p> | ||
{:then errors} | ||
{#if errors.length > 0} | ||
<!-- only show X if not valid - no tick if valid --> | ||
<CheckMark valid={false} /> | ||
{#each errors as error} | ||
<p style="color: red">Error: {error}</p> | ||
{/each} | ||
{:else} | ||
<p title="dtypes match and shapes are consistent"> | ||
{datasets.length} Datasets checked <span style="color:green">✓</span> | ||
</p> | ||
{/if} | ||
{:catch error} | ||
<p style="color: red">{error.message}</p> | ||
{/await} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters