Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/scripts/fill_download_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def index_files(index_dir: Path | None, paths: list[Path]) -> list[Path]:
the pull request changed.
"""
if paths:
return [path for path in paths if path.name not in NON_DATASET_FILES]
# A pull request that removes an entry names a file that is gone.
return [path for path in paths if path.name not in NON_DATASET_FILES and path.exists()]
if index_dir is None:
return dataset_files()
return sorted(p for p in index_dir.rglob("*.y*ml") if p.name not in NON_DATASET_FILES)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fill_download_fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Fill in the checksum and size
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
files=$(git diff --name-only origin/${{ github.base_ref }}... -- 'emdatabase/index/*.yaml')
files=$(git diff --name-only --diff-filter=AM origin/${{ github.base_ref }}... -- 'emdatabase/index/*.yaml')
if [ -z "$files" ]; then
echo "no index file changed" | tee filled.md
exit 0
Expand Down
14 changes: 1 addition & 13 deletions docs/source/_build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def generate_weights_html() -> str:


def generate_add_dataset_html() -> str:
"""The Add Dataset page: what a submission needs, and the two ways to send one."""
"""The Add Dataset page: the issue form, and the CLI as the terminal route."""
body = (
'<main class="app-main"><div class="explainer">'
'<div class="app-hero" style="padding:24px 0 6px">'
Expand All @@ -964,18 +964,6 @@ def generate_add_dataset_html() -> str:
"an action turns it into the entry\u2019s YAML file, fills in whatever it can "
"work out for itself, and opens the pull request.</p>"
"</div>"
"<h2>What to have ready</h2>"
"<ul>"
"<li>A direct link to the file. A Google Drive share link or a Zenodo file "
"link both work.</li>"
"<li>The file name, if the link does not end in one.</li>"
"<li>A description of the data, the licence it is released under, and how it "
"was acquired \u2014 one technique or several.</li>"
"<li>The authors, one per line, as "
"<code>Name; Affiliation; ORCID</code>. The ORCID is optional.</li>"
"<li>For model weights: the class the checkpoint loads into, the framework it "
"was saved with, and the quantem versions it loads under.</li>"
"</ul>"
'<p class="note">The checksum and the size are filled in automatically by '
"downloading the file, so both can be left blank.</p>"
'<div class="submit-row">'
Expand Down
11 changes: 11 additions & 0 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ that record, and moves ``latest`` to it. The file it looks for in the new
record is the one whose name matches the current link; if the name has changed
and the record holds more than one file, the run fails rather than guess.

Removing an entry
-----------------

Delete the entry's file from ``emdatabase/index/``, run
``python -m emdatabase._create_stubs`` so ``emdatabase/data/__init__.pyi`` no
longer lists it, and open a pull request. Copies people have already downloaded
are not touched. If the weekly weights job archived versions of a weights family
to the ``weights-archive`` release, delete those assets too::

gh release delete-asset weights-archive <Family>_<date>.pt

Hosting
-------

Expand Down
16 changes: 1 addition & 15 deletions emdatabase/data/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -326,20 +326,6 @@ class TutorialUNet(DownloadableDataset):
Model weights hosted at https://drive.google.com; see ``.versions`` for the dated snapshots.


"""
...

class TutorialUNet_instance(DownloadableDataset):
"""
TutorialUNet_instance

Weights of the instance segmenting model from `neural_networks_02_unet.ipynb` available in the `quantem-tutorials` repository.

License: CC-BY-4.0

Model weights hosted at https://drive.google.com; see ``.versions`` for the dated snapshots.


"""
...

Expand All @@ -358,4 +344,4 @@ class ZrNbPrecipitate(DownloadableDataset):
"""
...

__all__ = ['AlNanocrystals', 'AmorphousFilm4nm4DSTEM', 'ApoferritinApollo15eps', 'BilayerWS2', 'CuZnEELSMapping', 'CuZnHAADF', 'FeAlStripes', 'HREBSDStrainPatterns', 'InSituElectrochemGrowth', 'LSMOLineScan', 'LSMOLineScanLowLoss', 'LSMOSTOLineScan', 'LSMOSTOLineScanLowLoss', 'LayeredCuNb4DSTEM', 'MgONanoCrystals', 'NiEBSDLarge', 'PdCuSiCrystallization', 'PdNiPGlass', 'PeakDetectionPolymers', 'SPEDAg', 'TutorialUNet', 'TutorialUNet_instance', 'ZrNbPrecipitate']
__all__ = ['AlNanocrystals', 'AmorphousFilm4nm4DSTEM', 'ApoferritinApollo15eps', 'BilayerWS2', 'CuZnEELSMapping', 'CuZnHAADF', 'FeAlStripes', 'HREBSDStrainPatterns', 'InSituElectrochemGrowth', 'LSMOLineScan', 'LSMOLineScanLowLoss', 'LSMOSTOLineScan', 'LSMOSTOLineScanLowLoss', 'LayeredCuNb4DSTEM', 'MgONanoCrystals', 'NiEBSDLarge', 'PdCuSiCrystallization', 'PdNiPGlass', 'PeakDetectionPolymers', 'SPEDAg', 'TutorialUNet', 'ZrNbPrecipitate']
2 changes: 1 addition & 1 deletion emdatabase/index/PeakDetectionPolymers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PeakDetectionPolymers:
affiliation: Stanford University
kind: weights
model:
class: other
class: quantem.core.ml.CNN2d
framework: torch
latest:
url: https://zenodo.org/records/22311217/files/best.pth
Expand Down
26 changes: 0 additions & 26 deletions emdatabase/index/TutorialUNet_instance.yaml

This file was deleted.

12 changes: 12 additions & 0 deletions emdatabase/tests/test_fill_download_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,15 @@ def test_an_entry_that_will_not_validate_is_not_written(script, index, tmp_path)
assert code == 1
assert path.read_text(encoding="utf-8") == before
assert "Tomograhy" in summary


def test_a_file_the_pull_request_deleted_is_skipped(script, index, tmp_path):
"""A removed entry is named by the diff but is not there to read."""
_, directory, write = index
path = write()
gone = directory / "Removed.yaml"

code, _ = _run(script, directory, tmp_path, str(path), str(gone))
assert code == 0
assert "checksum" in path.read_text(encoding="utf-8")
assert not gone.exists()
2 changes: 1 addition & 1 deletion emdatabase/tests/test_issue_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def test_add_dataset_page_points_at_the_issue_form_and_the_cli(build_docs):
assert build_docs._ISSUE_URL.endswith("/issues/new?template=new_dataset.yaml")
assert "python -m emdatabase.new_dataset" in html
assert "--kind weights" in html
assert "Name; Affiliation; ORCID" in html
assert "filled in automatically" in html
for gone in ("<form", "<input", "spark-md5", "emdbBuildYaml"):
assert gone not in html, gone

Expand Down
Loading