Skip to content

Function attribute needs to out of function internal function definition. #4108

@abhishekchitwar

Description

@abhishekchitwar

Description of the modifications

Function attribute needs to out of function, internal function definition. raises the attribute error.

Updated Version

def display_monitor_table(monitor_set_name="mass-bal-rplot"):
    def display_table():
        data = solver.monitors.get_monitor_set_data(monitor_set_name=monitor_set_name)
        # extract iteration numbers
        iterations = data[0]
        # filter out additional callbacks
        if len(iterations) > display_table.iter_count:
            display_table.iter_count = len(iterations)
            # extract results
            results = data[1]
            # create a DataFrame
            df = pd.DataFrame(results, index=iterations)
            df.index.name = 'Iteration'
            df.reset_index(inplace=True)
            # The streamed data contains duplicates, so eliminate them
            df = df.drop_duplicates(subset='Iteration')
            print(tabulate(df, headers='keys', tablefmt='psql'))
    display_table.iter_count = 0 #--> This function attribute needs to out of the display_table() function
    return display_table

Useful links and references

https://fluent.docs.pyansys.com/version/stable/user_guide/monitors.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationDocumentation related (improving, adding, etc)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions