Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3844030
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:01:32+00:00 2026-05-19T16:01:32+00:00

The desire is for the user to instantiate a class that represents the transeint

  • 0

The desire is for the user to instantiate a class that represents the transeint along with automatic access to a member item for each variable being represented (up to 200 variables). The set of variable class instances would be dynamic based on file based input data and the desire is to use the file provided variable names to create a collection of these variable instances that are accessible with a natural naming scheme. Effectively, the variable class hides the details of where the data is stored and the indepedent variable (ie, time) is stored. The following pseudo code expresses random lines that the end user may express. In some cases, the post processing may be much more extensive.

tran1 = CTransient('TranData', ...)
Padj = tran1.pressPipe1 + 10  # add 10 bar to a pressure for conservatism
Tsat = TsatRoutine( tran1.tempPipe1 )
MyPlotRoutine( tran1.tempPipe1, tran1.tempPipe2 )

where pressPipeX and tempPipeX names defined in the input data files and the corresponding numpy data vectors are specified in the ‘TranData’ file input file and are instances of a CVariable class.

Help on how to dynamically build the set of instances that represent the transient variables such that they can be accessed would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T16:01:32+00:00Added an answer on May 19, 2026 at 4:01 pm

    Your description of what you’re trying to do isn’t entirely clear, but automatically naming variables something1, something2, etc. are generally a bad idea. Use a list instead:

    transientvariables = []
    transientvariables.append(makenewtransientvariable())
    # ...
    for tv in transientvariables:
        print tv
    

    Edit: OK, I think I see what you’re getting at, although your explanation still isn’t exactly easy to read. You have a collection of pipes, with a time series of temperature and pressure recorded for each one, right?

    The easiest way would be to use a dictionary:

    transients["tempPipe1"]
    

    Or nested dictionaries:

    transients["temp"]["Pipe1"]
    

    Or you could override your class’ __getattr__ method, so that it looks in a dictionary, and you can do:

    transients.tempPipe1
    

    Edit 2: Overriding __getattr__ would look a bit like this:

    def __getattr__(self, name):
        if name in self.varMap:
            return self.varMap[name]
        raise AttributeError
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, the desired result I have User and Item models. I'd like to build
There is a desire in one of my teams to force user's to provide
I have app that works perfectly fine on my Phone (desire HD). When I
I'm currently working in an app that shows a contact list to the user.
Here is my problem. I have a ticket-tracking system that is not very 'user
I have a User model that, in my mind, has two show actions: A
I am working in an application that creates online accounts(Let suppose Gmail) When user
I’m having issues with a WPF Expander that I have in a user control
I want to store user picture along with other attributes, I want to store
I was thinking about developing an app that enables the user to remotely check

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.