Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,111 @@
|
|
| 1 |
-
---
|
| 2 |
-
license:
|
| 3 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: per-file-license
|
| 4 |
+
license_link: LICENSE
|
| 5 |
+
task_categories:
|
| 6 |
+
- text-generation
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
tags:
|
| 10 |
+
- astronomy
|
| 11 |
+
- astrophysics
|
| 12 |
+
- source-code
|
| 13 |
+
- ascl
|
| 14 |
+
pretty_name: ASCL Astronomy Source Code
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# ASCL Astronomy Source Code
|
| 18 |
+
|
| 19 |
+
The [Astrophysics Source Code Library](https://ascl.net) (ASCL) is a curated registry of
|
| 20 |
+
source code used in astronomy and astrophysics research. This dataset contains source files
|
| 21 |
+
extracted from ASCL-listed repositories, paired with catalog metadata.
|
| 22 |
+
|
| 23 |
+
## Dataset Structure
|
| 24 |
+
|
| 25 |
+
### Manifest (`manifest.parquet`)
|
| 26 |
+
|
| 27 |
+
One row per ASCL catalog entry with the following fields:
|
| 28 |
+
|
| 29 |
+
| Field | Description |
|
| 30 |
+
| --- | --- |
|
| 31 |
+
| `ascl_id` | ASCL identifier (e.g., `[ascl:2306.019]`) |
|
| 32 |
+
| `title` | Software title |
|
| 33 |
+
| `authors` | Author list |
|
| 34 |
+
| `description` | Abstract / description from ASCL |
|
| 35 |
+
| `detail_url` | ASCL detail page URL |
|
| 36 |
+
| `repo_url` | GitHub/GitLab/Bitbucket URL (if found) |
|
| 37 |
+
| `code_site` | Project homepage URL |
|
| 38 |
+
| `ads_url` | ADS bibcode URL |
|
| 39 |
+
| `license_type` | Detected license (e.g., MIT, GPL-3.0) |
|
| 40 |
+
| `license_file` | Path to license file in repo |
|
| 41 |
+
|
| 42 |
+
### Source Code (`code/*.parquet`)
|
| 43 |
+
|
| 44 |
+
Stack-style source files extracted from cloned repositories (one row per file):
|
| 45 |
+
|
| 46 |
+
| Field | Description |
|
| 47 |
+
| --- | --- |
|
| 48 |
+
| `ascl_id` | ASCL identifier |
|
| 49 |
+
| `repo_url` | Source repository URL |
|
| 50 |
+
| `file_path` | Relative path within repo |
|
| 51 |
+
| `content` | File text content |
|
| 52 |
+
| `language` | Detected programming language (from file extension) |
|
| 53 |
+
| `license_type` | License detected from the repository |
|
| 54 |
+
| `size` | File size in bytes |
|
| 55 |
+
|
| 56 |
+
## Data Collection Methodology
|
| 57 |
+
|
| 58 |
+
### Phase 1: Catalog Scrape
|
| 59 |
+
|
| 60 |
+
The ASCL catalog is scraped to extract metadata for each entry: title, authors, description,
|
| 61 |
+
repository URLs, and ADS bibcode links. Only entries with a repository URL on GitHub, GitLab,
|
| 62 |
+
or Bitbucket proceed to Phase 2.
|
| 63 |
+
|
| 64 |
+
### Phase 2: Code Extraction
|
| 65 |
+
|
| 66 |
+
Each repository is shallow-cloned (`--depth 1`), its license file is detected and classified
|
| 67 |
+
via regex pattern matching, and all recognised source files are extracted into Parquet batches.
|
| 68 |
+
Language detection uses file extension mapping (Python, C, C++, Fortran, Julia, R,
|
| 69 |
+
MATLAB/Octave, IDL, Java, Rust, Go, JavaScript, Shell, and others).
|
| 70 |
+
|
| 71 |
+
## Limitations
|
| 72 |
+
|
| 73 |
+
- **Repository coverage**: only repos hosted on GitHub, GitLab, or Bitbucket are included;
|
| 74 |
+
code distributed via tarballs, personal websites, or other non-git hosting is skipped.
|
| 75 |
+
- **Shallow clones only**: only the latest commit is captured — no version history.
|
| 76 |
+
- **Language detection is extension-based**: file extensions are mapped to languages; there is
|
| 77 |
+
no content-based language classification.
|
| 78 |
+
- **License detection is regex-based**: licenses are identified by pattern matching against
|
| 79 |
+
common license file names and text; unusual or custom licenses may be misclassified or
|
| 80 |
+
reported as `Unknown`.
|
| 81 |
+
- **No deduplication**: if multiple ASCL entries point to the same repository, its files may
|
| 82 |
+
appear more than once.
|
| 83 |
+
|
| 84 |
+
## Licensing
|
| 85 |
+
|
| 86 |
+
This is a multi-license dataset. Each row carries a `license_type` field indicating the
|
| 87 |
+
license detected for that repository. Individual source files retain their original licenses
|
| 88 |
+
as set by their authors. Catalog metadata originates from [ASCL](https://ascl.net).
|
| 89 |
+
|
| 90 |
+
## Usage
|
| 91 |
+
|
| 92 |
+
```python
|
| 93 |
+
from datasets import load_dataset
|
| 94 |
+
|
| 95 |
+
# Load catalog metadata
|
| 96 |
+
ds_manifest = load_dataset("Smith42/ascl-code", data_files="manifest.parquet")
|
| 97 |
+
|
| 98 |
+
# Load source code files
|
| 99 |
+
ds_code = load_dataset("Smith42/ascl-code", data_files="code/*.parquet")
|
| 100 |
+
|
| 101 |
+
# Filter to a specific license
|
| 102 |
+
mit_code = ds_code["train"].filter(lambda x: x["license_type"] == "MIT")
|
| 103 |
+
|
| 104 |
+
# Filter to Python files
|
| 105 |
+
python_code = ds_code["train"].filter(lambda x: x["language"] == "Python")
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
## Source
|
| 109 |
+
|
| 110 |
+
Built with [`scrape_ascl.py`](https://github.com/Smith42/filter-mint) from the
|
| 111 |
+
[filter-mint](https://github.com/Smith42/filter-mint) repository.
|