Skip to content

Commit

Permalink
update parser
Browse files Browse the repository at this point in the history
  • Loading branch information
shinokumura committed Nov 27, 2022
1 parent fefaa56 commit 27a3d0f
Show file tree
Hide file tree
Showing 107 changed files with 1,281 additions and 63,285 deletions.
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ dmypy.json
geo/
docker/
plotting/
test/
exfor_dictionary/
examples/
evaluations/
.vscode/
pickles/*.py
processed*.dat
error.dat
Expand All @@ -171,5 +176,7 @@ JSONexamples/
pypartest.py
_trash.py
_*
# *.dat
mongo_db_manager.ipynb
invenio.py
mongodb.py
run.sh*.log
tabulated.py
47 changes: 15 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
The repository is still under developments and not ready to use. It made
public to share the progress between collaborators. No documents are available yet.

A related parser currently under development to support WPEC SG50 can be found at : https://github.com/IAEA-NDS/exfor-parserpy

## Using exforparser

Expand Down Expand Up @@ -46,47 +45,31 @@ M06350212 M0635 021 2 2003 V.V.Varlamov 1.980e+01 2.760e+01
```

### Conversion of EXFOR to JSON
There are three ways to run the conversion.
There are three ways to run the conversion. All converted JSON files are in [IAEA-NDS/exfor_json](https://github.com/IAEA-NDS/exfor_json) repository.

1. First you need to download and extract EXFOR master file.
1. First, you need to download EXFOR master files from [IAEA-NDS/exfor_master](https://github.com/IAEA-NDS/exfor_master) repository.

2. Change the EXFOR master file path (``EXFOR_ALL_PATH``) and output path (``OUT_PATH``) in ``path.py``.
2. Change the EXFOR master file path (``EXFOR_ALL_PATH``) and output path (``OUT_PATH``) in ``config.py``.

3. Now we can make convertion from EXFOR to JSON, for instance, to convert entry number 12898 and 40467:
3. Convert from EXFOR to JSON, for instance, for EXFOR entry number 12898 and 40467:

```
from exparser import convert_entries
import json
from exparser import convert_exfor_to_json
entries = ["12898", "40467"]
convert_entries(entries)
```

or if you already know the entry number, subentry number, and pointer (pointer is "XX" if there is no pointer specified.) then,

```
from exparser import convert_single
convert_single("40944", "002", "XX")
```

if you need an output as x-dx-y-dy format with minimal bib data like [EXFORTABLES](https://nds.iaea.org/talys/),
for entry in entries:
entry_json = convert_exfor_to_json(entry)
print(json.dumps(entry_json, indent = 1))
```
from tabulated import exfortableformat
exfortableformat("40944", "002", "XX")
```

## Use converted data
Some of converted data are stored in MongoDb cluster service. Please read details in [.ipynb file](https://github.com/shinokumura/exforparser/blob/main/examples/example_bib_reaction_parse.ipynb) and follow the procedure in it.

1. Download the Jupyter notebook file from [here](https://raw.githubusercontent.com/shinokumura/exforparser/main/examples/example_bib_reaction_parse.ipynb) by pressing ctrl+s to save it as .ipynb (Note that you’ll have to manually type ‘.ipynb’.)

2. Run the Jupyter Notebook with the downloaded file as follows:
```
jupyter notebook example_bib_reaction_parse.ipynb
```

If you don't have Jupyter notebook environment, you can run it from Binder from followin button.
### Future works
More functions will come soon.

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/shinokumura/exforparser/main?labpath=examples%2Fexample_bib_reaction_parse.ipynb)
### Related works
[IAEA-NDS/exfor_master](https://github.com/IAEA-NDS/exfor_master)

[IAEA-NDS/exfor_json](https://github.com/IAEA-NDS/exfor_json)

[IAEA-NDS/exfor_dictionary](https://github.com/IAEA-NDS/exfor_dictionary)

19 changes: 6 additions & 13 deletions path.py → config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
####################################################################

DICTIONARY_URL = "https://nds.iaea.org/nrdc/ndsx4/trans/dicts/"
DICTIONARY_PATH = "/Users/sin/Dropbox/Development/exforparser/dictionary/"
DICTIONARY_PATH = "exfor_dictionary/"

""" EXFOR master file path """
EXFOR_ALL_PATH = "/Users/sin/Documents/nucleardata/EXFOR/X4all/"
EXFOR_ALL_URL = "https://nds.iaea.org/exfor-master/backup/"
EXFOR_ALL_PATH = "/Users/sin/Documents/nucleardata/EXFOR/exfor_master/exforall/"
EXFOR_MASTER_REPO_PATH = "/Users/sin/Documents/nucleardata/EXFOR/exfor_master/"


""" Pickle path of list of EXFOR master files made by parser.list_x4files.py"""
ENTRY_INDEX_PICKLE = "pickles/entry.pickle"
Expand All @@ -25,18 +28,8 @@
TO_JSON = True
POST_DB = False

OUT_PATH = "examples/"
OUT_PATH = "/Users/sin/Desktop/exfor_json/"

MONGOBASE_URI = "https://data.mongodb-api.com/app/data-qfzzc/endpoint/data/beta/"
API_KEY = "uLxfjSQjf2YCyPxocPHHla22HTHoEA6IGpXBlToaddOqN7V3QHV0iNbVGCuFulTW"
DB_KEY = "nds:9ZCo6KYA8XYbTy1G" ## read only account


import os
def check_x4alldir():
from parser.exceptions import Nox4AllDirExistenceError

if os.path.isdir(EXFOR_ALL_PATH):
return True
else:
raise Nox4AllDirExistenceError(EXFOR_ALL_PATH)
83 changes: 0 additions & 83 deletions dictionary/README.md

This file was deleted.

Loading

0 comments on commit 27a3d0f

Please sign in to comment.