Skip to content

Commit

Permalink
Fix allsky and interesction bugs in STC-S
Browse files Browse the repository at this point in the history
  • Loading branch information
fxpineau committed Dec 20, 2023
1 parent 1fac533 commit 67f8008
Show file tree
Hide file tree
Showing 12 changed files with 319 additions and 29 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
# `moc` Change Log

## 0.11.4
## 0.12.1

Released 2023-12-20

### Fixed

* Bugs in the stcs2moc: allky not complete + intesection error comming from cdshealpix BMOC
* Update CDSHealpix

## 0.12.0

Released 2023-12-11

### Added

* stcs2moc functionnality


## 0.11.4

Never Released

### Added

* test index validity in ASCII MOCs


Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[package]
name = "moc"
version = "0.12.0"
version = "0.12.1"
authors = [
"F.-X. Pineau <[email protected]>",
"Matthieu Baumann <[email protected]>"
Expand Down Expand Up @@ -51,7 +51,7 @@ exclude = ["crates/wasm"]
num = "0.4.1"
nom = "7.1.3"
quick-error = "2.0.1"
healpix = { package = "cdshealpix", version = "0.6.6" }
healpix = { package = "cdshealpix", version = "0.6.7" }
mapproj = "0.3"
serde_json = "1.0"
byteorder = "1.4.3"
Expand Down
7 changes: 7 additions & 0 deletions crates/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# `moc-cli` Change Log

## 0.8.1

Released 2023-12-20

* Fix issues S-MOC from STC-S
* Update cdshealpix

## 0.8.0

Released 2023-12-12
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "moc-cli"
version = "0.8.0"
version = "0.8.1"
authors = ["F.-X. Pineau <[email protected]>"]
description = "Command-line to create and manipulate HEALPix Multi-Order Coverages maps (MOCs)"
license = "MIT OR Apache-2.0"
Expand All @@ -24,7 +24,7 @@ test = false
moclib = { package = "moc", path = "../.." }
num = "0.4"
structopt = "0.3"
healpix = { package = "cdshealpix", version = "0.6.3" }
healpix = { package = "cdshealpix", version = "0.6.7" }
mapproj = "0.3.0"
rayon = "1.5.1"
time = { version = "0.3.3", features = ["parsing"] }
Expand Down
123 changes: 117 additions & 6 deletions crates/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ sys 0m0,005s

### Build a S-MOC from a STC-S string

Example from the STC-S document:
#### Example from the STC-S document:
```bash
echo "Circle ICRS 147.6 69.9 0.4" | moc from stcs 14 - fits stcs.moc.fits --force-u64
moc view stcs.moc.fits moc.png auto 200
Expand All @@ -284,7 +284,8 @@ Gives:
![MOC froma STC-S cone](img/stcs_circle.png)


Union of polygons extracted from the ObsCore table in the ESO TAP service:
#### Union of polygons extracted from the ObsCore table in the ESO TAP service

```bash
echo "UNION ICRS (
POLYGON 97.910103 -68.229734 98.035349 -68.420531 97.511326 -68.464218 97.391307 -68.272593
Expand All @@ -303,19 +304,129 @@ echo "UNION ICRS (
POLYGON J2000 97.864897 -69.363161 97.991114 -69.554985 97.438647 -69.599924 97.315514 -69.407714
POLYGON J2000 97.100269 -69.424445 97.22188 -69.616836 96.665842 -69.65841 96.54754 -69.46587
POLYGON J2000 96.332041 -69.481439 96.448747 -69.674048 95.891855 -69.712065 95.778776 -69.519528
)" | sed -r 's/J2000//g' | moc from stcs 16 - fits stcs.fits --force-u64
)" | sed -r 's/J2000//g' | \
moc from stcs 16 - fits stcs.fits --force-u64
moc view stcs.fits moc.png auto 600
```
Gives:

![MOC from STC-S UNION of Polygons](img/stcs_union_poly.png)

Remarks:
* we so far support only `ICRS` so we replace the firts `J2000` in the origianl string by `ICRS`
* the STC-S is not standard so we remove the `J2000` using `sed`.
* we so far support only `ICRS` so we replace the firts `J2000` in the original string by `ICRS`
* the STC-S is not standard (with respect to the STC-S draft) so we remove the `J2000` using `sed`.

#### Complex polygon

```bash
echo "Polygon ICRS 259.779020 -36.182932 259.776702 -36.186804 259.771638 -36.185890
259.772903 -36.170965 259.770948 -36.168452 259.766725 -36.170651 259.762834 -36.167880
259.763731 -36.165062 259.767126 -36.163827 259.768464 -36.153306 259.775446 -36.148788
259.769596 -36.135517 259.764601 -36.133574 259.763255 -36.126446 259.755778 -36.124821
259.753657 -36.122446 259.752091 -36.125717 259.748402 -36.126581 259.744966 -36.123224
259.749312 -36.114598 259.762948 -36.106041 259.759436 -36.103058 259.760376 -36.099663
259.765016 -36.098826 259.767684 -36.102082 259.773773 -36.098700 259.768227 -36.092652
259.769796 -36.079719 259.774018 -36.074916 259.779750 -36.073295 259.774669 -36.062560
259.770285 -36.062490 259.768332 -36.059390 259.770514 -36.056611 259.777253 -36.055429
259.792567 -36.057523 259.795238 -36.060699 259.791804 -36.064056 259.782410 -36.062939
259.789399 -36.075403 259.787283 -36.077757 259.778147 -36.080762 259.776591 -36.091715
259.784863 -36.095193 259.786494 -36.102683 259.794458 -36.104560 259.797513 -36.103525
259.800137 -36.102101 259.802003 -36.094898 259.795104 -36.098376 259.791948 -36.096974
259.791273 -36.094116 259.796555 -36.089885 259.800794 -36.089963 259.800636 -36.078803
259.805260 -36.076262 259.808825 -36.078801 259.807830 -36.084885 259.810448 -36.094643
259.808066 -36.103578 259.799912 -36.109740 259.801174 -36.113477 259.805956 -36.115134
259.805673 -36.118789 259.801985 -36.120191 259.794028 -36.118194 259.779591 -36.127983
259.780279 -36.132041 259.776522 -36.134755 259.785372 -36.148741 259.791126 -36.148934
259.793243 -36.143417 259.796550 -36.141837 259.805073 -36.147755 259.803338 -36.150735
259.794941 -36.152696 259.792043 -36.155585 259.779929 -36.153563 259.776332 -36.155577
259.774520 -36.160554 259.780315 -36.168504" | \
moc from stcs 18 - fits stcs_alma1.moc.fits --force-u64
moc view stcs_alma1.moc.fits stcs_alma1.moc.png auto 600
```

Gives:

![MOC from a complex STC-S polygon](img/stcs_alma1.moc.png)


#### Complex polygon with holes


Either
```bash
echo "Difference ICRS (
Polygon 272.536719 -19.461249 272.542612 -19.476380 272.537389 -19.491509 272.540192 -19.499823
272.535455 -19.505218 272.528024 -19.505216 272.523437 -19.500298 272.514082 -19.503376
272.502271 -19.500966 272.488647 -19.490390 272.481932 -19.490913 272.476737 -19.486589
272.487633 -19.455645 272.500386 -19.444996 272.503003 -19.437557 272.512303 -19.432436
272.514132 -19.423973 272.522103 -19.421523 272.524511 -19.413250 272.541021 -19.400024
272.566264 -19.397500 272.564202 -19.389111 272.569055 -19.383210 272.588186 -19.386539
272.593376 -19.381832 272.596327 -19.370541 272.624911 -19.358915 272.629256 -19.347842
272.642277 -19.341020 272.651322 -19.330424 272.653174 -19.325079 272.648903 -19.313708
272.639616 -19.311098 272.638128 -19.303083 272.632705 -19.299839 272.627971 -19.289408
272.628226 -19.276293 272.633750 -19.270590 272.615109 -19.241810 272.614704 -19.221196
272.618224 -19.215572 272.630809 -19.209945 272.633540 -19.198681 272.640711 -19.195292
272.643028 -19.186751 272.651477 -19.182729 272.649821 -19.174859 272.656782 -19.169272
272.658933 -19.161883 272.678012 -19.159481 272.689173 -19.176982 272.689395 -19.183512
272.678006 -19.204016 272.671112 -19.206598 272.664854 -19.203523 272.662760 -19.211156
272.654435 -19.214434 272.652969 -19.222085 272.656724 -19.242136 272.650071 -19.265092
272.652868 -19.274296 272.660871 -19.249462 272.670041 -19.247807 272.675533 -19.254935
272.673291 -19.273917 272.668710 -19.279245 272.671460 -19.287043 272.667507 -19.293933
272.669261 -19.300601 272.663969 -19.307130 272.672626 -19.308954 272.675225 -19.316490
272.657188 -19.349105 272.657638 -19.367455 272.662447 -19.372035 272.662232 -19.378566
272.652479 -19.386871 272.645819 -19.387933 272.642279 -19.398277 272.629282 -19.402739
272.621487 -19.398197 272.611782 -19.405716 272.603367 -19.404667 272.586162 -19.422703
272.561792 -19.420008 272.555815 -19.413012 272.546500 -19.415611 272.537427 -19.424213
272.533081 -19.441402
Union (
Polygon 272.511081 -19.487278 272.515300 -19.486595 272.517029 -19.471442
272.511714 -19.458837 272.506430 -19.459001 272.496401 -19.474322 272.504821 -19.484924
Polygon 272.630446 -19.234210 272.637274 -19.248542 272.638942 -19.231476 272.630868 -19.226364
)
)"
```
or
```bash
echo "Intersection ICRS (
Polygon 272.536719 -19.461249 272.542612 -19.476380 272.537389 -19.491509 272.540192 -19.499823
272.535455 -19.505218 272.528024 -19.505216 272.523437 -19.500298 272.514082 -19.503376
272.502271 -19.500966 272.488647 -19.490390 272.481932 -19.490913 272.476737 -19.486589
272.487633 -19.455645 272.500386 -19.444996 272.503003 -19.437557 272.512303 -19.432436
272.514132 -19.423973 272.522103 -19.421523 272.524511 -19.413250 272.541021 -19.400024
272.566264 -19.397500 272.564202 -19.389111 272.569055 -19.383210 272.588186 -19.386539
272.593376 -19.381832 272.596327 -19.370541 272.624911 -19.358915 272.629256 -19.347842
272.642277 -19.341020 272.651322 -19.330424 272.653174 -19.325079 272.648903 -19.313708
272.639616 -19.311098 272.638128 -19.303083 272.632705 -19.299839 272.627971 -19.289408
272.628226 -19.276293 272.633750 -19.270590 272.615109 -19.241810 272.614704 -19.221196
272.618224 -19.215572 272.630809 -19.209945 272.633540 -19.198681 272.640711 -19.195292
272.643028 -19.186751 272.651477 -19.182729 272.649821 -19.174859 272.656782 -19.169272
272.658933 -19.161883 272.678012 -19.159481 272.689173 -19.176982 272.689395 -19.183512
272.678006 -19.204016 272.671112 -19.206598 272.664854 -19.203523 272.662760 -19.211156
272.654435 -19.214434 272.652969 -19.222085 272.656724 -19.242136 272.650071 -19.265092
272.652868 -19.274296 272.660871 -19.249462 272.670041 -19.247807 272.675533 -19.254935
272.673291 -19.273917 272.668710 -19.279245 272.671460 -19.287043 272.667507 -19.293933
272.669261 -19.300601 272.663969 -19.307130 272.672626 -19.308954 272.675225 -19.316490
272.657188 -19.349105 272.657638 -19.367455 272.662447 -19.372035 272.662232 -19.378566
272.652479 -19.386871 272.645819 -19.387933 272.642279 -19.398277 272.629282 -19.402739
272.621487 -19.398197 272.611782 -19.405716 272.603367 -19.404667 272.586162 -19.422703
272.561792 -19.420008 272.555815 -19.413012 272.546500 -19.415611 272.537427 -19.424213
272.533081 -19.441402
Not (Polygon 272.511081 -19.487278 272.515300 -19.486595 272.517029 -19.471442
272.511714 -19.458837 272.506430 -19.459001 272.496401 -19.474322 272.504821 -19.484924)
Not (Polygon 272.630446 -19.234210 272.637274 -19.248542 272.638942 -19.231476 272.630868 -19.226364)
)" | \
moc from stcs 16 - fits stcs_alma2.moc.fits --force-u64
moc view stcs_alma2.moc.fits stcs_alma2.moc.png auto 600
```

Gives:

![MOC from a complex STC-S polygon](img/stcs_alma2.moc.png)


### Build a MOC from a (non STC-S) multi-region file

### Build a MOC from a multi-region file
Remark: this has been done before the S-MOC from STC-S features, you can use both methods.

Build a raw MOC from a list of polygon.
The `polygon_list.txt` file contains 1787 `POLYGON lon1_deg lat1_deg lon2_deg lat2_deg lon3_deg lat3_deg lon4_deg lat4_deg` rows.
Expand Down
Binary file added crates/cli/img/stcs_alma1.moc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/cli/img/stcs_alma2.moc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions crates/set/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# `moc-set` Change Log

## 0.8.1

Released 2023-12-20

* No modification, release due to new moc-cli and moc-wasm release
* Only update cdshealpix


## 0.8.0

Released 2023-12-12
Expand Down
4 changes: 2 additions & 2 deletions crates/set/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "moc-set"
version = "0.8.0"
version = "0.8.1"
authors = ["F.-X. Pineau <[email protected]>"]
description = "command-line tool to build, update and query a persistent set of HEALPix Multi-Order Coverages maps (MOCs)"
license = "MIT OR Apache-2.0"
Expand All @@ -22,7 +22,7 @@ test = false

[dependencies]
moclib = { package = "moc", path = "../.." }
cdshealpix = "0.6.3"
cdshealpix = "0.6.7"
memmap = { package = "memmap2", version = "0.5" }
clap = { version = "4.4", features = ["derive"] }
byteorder = "1"
Expand Down
8 changes: 8 additions & 0 deletions crates/wasm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# `moc-wasm` Change Log

## 0.8.1

Released 2023-12-20

* Fix issues S-MOC from STC-S
* Update cdshealpix


## 0.8.0

Released 2023-12-12
Expand Down
4 changes: 2 additions & 2 deletions crates/wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "moc-wasm"
version = "0.8.0"
version = "0.8.1"
authors = ["F.-X. Pineau <[email protected]>"]
description = """
WASM library to create and manipulate HEALPix
Expand All @@ -22,7 +22,7 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
moclib = { package = "moc", path = "../..", features = ["storage"] }
healpix = { package = "cdshealpix", version = "0.6.3" }
healpix = { package = "cdshealpix", version = "0.6.7" }
serde = { version = "1.0.80", features = ["derive"] }
wasm-bindgen = { version = "0.2.78", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4.28"
Expand Down
Loading

0 comments on commit 67f8008

Please sign in to comment.