Skip to content

API first design #1

Description

@shervin86

A first discussion about design of the API is available here:
PaNOSC-ViNYL/ViNYL-project#65 (comment)

  • SimEx lite source + beamline + sample + detector working example
  • McStasScript source + beamline + sample + detector working example
  • Splitting example files in subfiles to test re-usage of same code parts in multiple instruments

Single class API with:

  • .init(url=the default repository, local_repo=some default local directory)
    • url: url of the github central repository
    • local_repo: local checkout directory. The user need the possibility to set it, but for the average user a default is ok
  • .ls_instrument()
    prints the names of the available instruments
  • .ls_versions(instrument)
    prints the available versions for the required instrument
  • .load_instrument (instrument_sample, version=HEAD)
    • instrument: can be a short name or the full path of the file the instrument file as include of source, beamline, effective instrument with detector
    • version:
      • HEAD: for the most recent
      • YYY_MM_DD: for a given old version
        if HEAD does not exist, it automagically pick up the most recent
        version? or return error to make sure the user knows?
    • returns the instrument object
  • .get_last_instrument_info()
    • returns a json with the following info:
      • instrument repository url
      • instrument file path in repository
      • git commit hash
  • .dump_instrument(outputfile)
    saves in .py format the instrument description
  • .diff_instrument(instrument_obj, instrument_name, version)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions