Giter Club home page Giter Club logo

citrine_converters's Introduction

Citrination Converters

This project provides a central housing for developing converters from various data sources. Note unless otherwise specified, all keys are processed and stored case insensitively.

Sources

  1. Mark10 (Mechanical testing data) Reads time, force and displacement data from the CSV output written by Mark10. If area=(float)` and units=(string) keywords are provided, then the stress will also be calculated. The available keys will depend on the input file, but based on early testing, are "time", "force", "disp", "area" (if specified), "stress" (if area and units are specified).
  2. Aramis (DIC strain data) Reads strain information from CSV output produced by Aramis.

Adding New Tests

Tests are critical to ensuring the continued stability and performance of any package. And this one is no exception. At present, the output from the test is compared against a previous run that was manually inspected. Please see test_*.py for examples. These, however, show the final product. How do we actually generate those outputs?

1. Run a "bad" test that generates the test file, e.g.

HERE = '/full/path/to/citrine_converters/test'
SOURCE = '{}/data/source_data.csv'.format(HERE)

assert os.isdir(HERE)
assert os.isfile(SOURCE)

@pytest.fixture
def equipment_data_no_modifier():
    pass

def test_data_no_modifier(equipment_data_no_modifier):
    pifs = pif.dumps(converter(SOURCE), sort_keys=True)
    # This will write the output of the test. Be sure to give this
    # a more meaningful name!
    with open('{}/data/equipment-data-no-modifier.json'.format(HERE), 'w') as ofs:
        ofs.write(pifs)
    # The test is intended to fail in this step.
    assert False
  1. Check equipment-data-no-modifier.json manually.

3. Create a "good" test.

HERE = '/full/path/to/citrine_converters/test'
SOURCE = '{}/data/source_data.csv'.format(HERE)

assert os.isdir(HERE)
assert os.isfile(SOURCE)

@pytest.fixture
def equipment_data_no_modifier():
    with open('{}/data/equipment-data-no-modifier.json'.format(HERE)) as ifs:
        reference = ifs.read()
    return reference

def test_data_no_modifier(equipment_data_no_modifier):
    # These two lines could be combined into a single line,
    # but this is more clear, imho.
    pifs = converter(SOURCE)
    pifs = pif.dumps(pifs, sort_keys=True)
    assert pifs == equipment_data_no_modifier

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.