nasa / progpy

The NASA Prognostic Python Packages is a Python framework focused on defining and building models and algorit for prognostics (computation of remaining useful life) of engineering systems, and provides a set of models and algorithms for select components developed within this framework, suitable for use in prognostic applications.
https://nasa.github.io/progpy/
Other
55 stars 8 forks source link

dropped ensemble requirement to single model #69

Closed Ashwani132003 closed 1 year ago

Ashwani132003 commented 1 year ago

Close #11

teubert commented 1 year ago

Follow-up note: ignore the failing tests. Tests are not working properly for some reason on this branch. For this PR I will run the tests manually

Ashwani132003 commented 1 year ago

Please check the below code for test_single_model: def test_single_model(self): """ This tests that the ensemble model works with a single model, ensuring that inputs, states, outputs, and events are correctly handled. """ m = OneInputOneOutputOneEventLM() em = EnsembleModel([m])

    # inputs, states, outputs, and events should be the same as the single model
    self.assertSetEqual(set(em.inputs), {'u1'})
    self.assertSetEqual(set(em.states), {'x1'})
    self.assertSetEqual(set(em.outputs), {'z1'})
    self.assertSetEqual(set(em.events), {'x1 == 10'})

    # Initialize
    x_t0 = em.initialize()
    self.assertEqual(x_t0['x1'], 0)

    # State transition
    u = em.InputContainer({'u1': 1})
    x_t1 = em.next_state(x_t0, u, 1)
    self.assertEqual(x_t1['x1'], 1)

    # Output
    z = em.output(x_t1)
    self.assertEqual(z['z1'], 1)

    # Event state
    es = em.event_state(x_t1)
    self.assertEqual(es['x1 == 10'], 0.9)

    # Threshold met
    self.assertFalse(em.threshold_met(x_t1)['x1 == 10'])

    # Transition again
    x_t2 = em.next_state(x_t1, u, 2)

    # Threshold met
    # x1 == 3
    self.assertFalse(em.threshold_met(x_t2)['x1 == 10'])

Is this implementation right, or i have to make changes.

One more thing while trying to do the changes and pushing the commit, I'm getting extra/previous commits alongside my commit, can you suggest some best way to do the changes without having to add them. image or i can try to make a new pr with all the changes in it.

kjjarvis commented 1 year ago

Hi @Ashwani132003, I'd be happy to help with your PR. Can you update me on the current status? Are you still having trouble with the extra/previous commits alongside yours?

Ashwani132003 commented 1 year ago

Hi @Ashwani132003, I'd be happy to help with your PR. Can you update me on the current status? Are you still having trouble with the extra/previous commits alongside yours?

hey, thanks for asking, but I somehow managed to resolve that, you can tell me if there are any other issues related to my pr.

kjjarvis commented 1 year ago

Hi @Ashwani132003, I'm glad you got the previous issues resolved. I'm reviewing your code and it looks good so far. I'm having trouble pulling your code, and I think it's because it's forked off of dev. Will you please branch off of the ProgPy dev branch, add the changes to that new branch, and then request a review from me and @teubert? Then we should be able to review and merge. Thank you!