benten metadata
目的
- メタデータを参照します。
Warning
事前にログイン認証を行う必要があります。
概要
- 認証時のアカウントでアクセスが許可されたデータのみメタデータ情報を取得できます。
- 登録名を指定してメタデータ情報が取得できます。
- ディレクトリ、またはファイル名を指定してメタデータ情報が取得できます。
利用例
- Help
$ benten.py metadata -h usage: benten metadata [-h] [--register_name [REGISTER_NAME]] [--file [FILE]] [--pattern [{user,all}]] optional arguments: -h, --help show this help message and exit --register_name [REGISTER_NAME], -r [REGISTER_NAME] register_name --file [FILE], -f [FILE] file --pattern [{user,all}], -p [{user,all}] pattern
- ディレクトリ指定での検索例
$ benten.py metadata -f "/SPring-8/BL14B2/XAFS_Standard/data2/Ba/L3/111/BaTaO2N ### benten metadata ### [Repository::authorize] access_token = 78fb9b529fcc4fbdb6ae2884664f2ba8 ==> response { "metadata_list":[ { "@data_info@access_rights":"open", "@data_info@contact_name@affiliation@organization":"JASRI", "@data_info@contact_name@name":"Industrial Application Division", "@data_info@contact_name@role":"organization", "@data_info@data_depositor@affiliation@organization":"JASRI", "@data_info@data_depositor@name":"Hironori Ofuchi", "@data_info@identifier@proposal_number":"2014S0000", "@data_info@identifier@register_name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N", "@data_info@facility":"SPring-8", "@data_info@class_name":"BL14B2", "@data_info@disk_name":"XAFS_Standard", "@data_info@title_ja":"標準試料", "@data_info@title":"Standard Sample", "@system@version@data_register":"0.6.0", "@facility@ring@end_current":99.6, "@facility@ring@end_current_unit":"mA", "@facility@ring@energy":8.0, "@facility@ring@energy_unit":"GeV", "@facility@ring@filling_pattern":"11/29-filling + 1 bunch", "@facility@ring@filling_pattern_mode":"H", "@facility@ring@start_current":99.6, "@facility@ring@start_current_unit":"mA", "@sample":[ { "chemical_formula":"BaTaO2N", "lot_number":"4817626", "model_number":"BAI08PB", "name":"Barium tantalum oxide nitride", "supplier":"KOJUNDO CHEMICAL LABORATORY" } ], "@measurement@date@end_time":"2020-02-06 00:45:00", "@measurement@date@start_time":"2020-02-06 00:41:00", "@measurement@method@absorption_edge":"Ba L3-edge", "@measurement@method@category":"spectroscopy", "@measurement@method@detection":"Transmission( 2)", "@measurement@method@sub_category":"XAFS", "@measurement@scan_mode":"angle axis (1)", "@instrument@monochrometer@distance":3.13551, "@instrument@monochrometer@distance_unit":"A", "@instrument@monochrometer@net_plane":"SI(111)", "@instrument@monochrometer@section":[ { "start_energy":23.71, "start_energy_unit":"deg", "step_energy":-0.0016, "step_energy_unit":"deg", "end_energy":19.945, "end_energy_unit":"deg", "dwell_time":100.0, "dwell_time_unit":"ms" } ], "@instrument@slit":[ { "name":"4Dslit", "vertical_size":1.0, "vertical_size_unit":"mm", "horizontal_size":5.0, "horizontal_size_unit":"mm" } ], "@instrument@xafs@I0@element":[ { "type":"Ion Chamber", "gas":"He 70% + N2 30%", "HV":1000.0, "HV_unit":"V", "amp_gain":100000000.0, "amp_gain_unit":"V/A" } ], "@instrument@xafs@I0@element_number":1, "@instrument@xafs@I1@element":[ { "type":"Ion Chamber", "gas":"N2 100%", "HV":1000.0, "HV_unit":"V", "amp_gain":1000000000.0, "amp_gain_unit":"V/A" } ], "@instrument@xafs@I1@element_number":1, "@data_info@date@create_time":"2020-04-09 23:24:24", "@data_info@data_origin":"experiment", "@system@version@metadata":"spring8-bl14b2-2020.04.27", "@dataset@directory_list":[ { "file_list":[ { "size":405, "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N.json", "time":"2020-04-28 15:17:14", "hash":"055712370a409797bc17412af435c22d", "uuid_name":"9f349c71-a0cb-4d04-86a7-f5d7a43215dd" }, { "size":345, "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N.system.json", "time":"2020-04-28 15:17:15", "hash":"21d247476d44f61cdc392ab958f32e3a", "uuid_name":"4daddc7d-f5db-46b7-bf4f-a2919d695d9c" }, { "size":4700, "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N.user.json", "time":"2020-04-28 15:17:14", "hash":"82bedbc43c02eaa2d81367e5dd421eb1", "uuid_name":"8040cb4f-8b30-4fc7-8057-7689894fe85c" } ], "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111" }, { "file_list":[ { "size":122967, "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N/Ba-L3_BaTaO2N_Si111_100ms_200205.dat", "time":"2020-02-06 00:45:20", "hash":"718d97e292c57fdbb33d29499c4efd55", "uuid_name":"69e5e045-a1ea-4b89-aee8-b930d8233d81" }, { "size":11414, "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N/Ba-L3_BaTaO2N_Si111_100ms_200205.ex3", "time":"2020-02-06 00:45:24", "hash":"3bddb550066d4718ad60f163e175ae82", "uuid_name":"20ea2a2d-8a23-4e71-a896-35868cda67d9" }, { "size":11016, "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N/Ba-L3_BaTaO2N_Si111_100ms_200205.txt", "time":"2020-02-06 00:45:24", "hash":"12abc984422cabcd1fae568dd9330dd8", "uuid_name":"68d1620c-46eb-4202-b138-81844b7defb7" }, { "size":33700, "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N/BaTaO2N.thumb.png", "time":"2020-03-04 04:54:22", "hash":"bcd5474881eae18585e720277724f992", "uuid_name":"1662f4ca-f9ac-403d-aa6e-422aad81792e" }, { "hash":"ccec208752a71f73fa9ed8d2b3f74e3c", "size":1213, "time":"2020-04-28 13:30:39", "uuid_name":"00547b0a-e148-4873-a345-4cf4d0d3410e", "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N/metadata.data_format.yml" }, { "hash":"499022d9e61ae54b433fe50890cf8f60", "size":289, "time":"2020-04-27 16:44:53", "uuid_name":"d446a755-3ba7-49f6-89bb-f8c996aed47f", "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N/metadata.data_info.yml" }, { "hash":"68ffdacc616f02a5e8535cf2eb98a994", "size":780, "time":"2020-04-22 08:42:43", "uuid_name":"8d315aa3-d874-488a-861c-e84b4621b5af", "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N/metadata.main.yml" } ], "name":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111/BaTaO2N" } ], "@system@version@agent":"1.1.0", "@data_info@date@update_time":"2020-04-28 15:17:15", "@system@uuid_register_directory":"/storage/volume-01/SPring-8/BL14B2/2020-04/816e041d-c40d-4f9a-959e-459a30cd2332", "@system@parent_directory":"/SPring-8/BL14B2/XAFS_Standard/Ba/L3/111", "@data_info@identifier@pid":"spring8.b355dd63-3301-47a9-984e-c8a7081284ac" } ] }
Pythonモジュールとの対応
- benten_client.rest_data.Metadataを利用
- 利用例 (example/benten_metadata.pyから)
#!/usr/bin/env python ''' example: metadata usage: python benten_metadata.py ... ''' import benten_client import argparse from logging import getLogger, StreamHandler, DEBUG logger = getLogger(__name__) handler = StreamHandler() handler.setLevel(DEBUG) logger.setLevel(DEBUG) logger.addHandler(handler) logger.propagate = False # ... parameters parser = argparse.ArgumentParser(description="example: metadata") parser.add_argument("--register_name", "-r", nargs="?", help="register_name") parser.add_argument("--file", "-f", nargs="?", help="file") parser.add_argument("--pattern", "-p", nargs="?", choices=["user", "all"], default="all", help="pattern") args = parser.parse_args() register_name = args.register_name file = args.file pattern = args.pattern v = {} if register_name is not None: v["register_name"] = register_name if file is not None: v["file"] = file if pattern is not None: v["pattern"] = pattern repo = benten_client.Repository() logger.debug("# set access token") repo.authorize(benten_client.access_token()) logger.debug("# benten metadata") ret_dict = repo.data.metadata.post(**v) benten_client.log("==> response") benten_client.out_json(ret_dict)