Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print line feature #282

Merged
merged 3 commits into from
Apr 20, 2021
Merged

Print line feature #282

merged 3 commits into from
Apr 20, 2021

Conversation

zptro
Copy link
Collaborator

@zptro zptro commented Apr 7, 2021

Can be used for printing a descriptive row of text for each agent.

Also adds better formatting when printing dataframes.

@zptro zptro requested a review from attesn April 7, 2021 08:17
West Jens added 2 commits April 7, 2021 15:35
Restrict number of significant digits to 7, larger numbers as exponents
@zptro
Copy link
Collaborator Author

zptro commented Apr 8, 2021

Moved column alignment to own PR: #283

@zptro zptro added this to the v4.0.5 milestone Apr 8, 2021
Copy link
Collaborator

@attesn attesn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enables more efficient and easy way of writing agent data to file. Good work.

Only thing that I was thinking if there is any good solution for writing column titles? On the other hand it is easy to write title row before looping over agents.

@attesn attesn merged commit 76d054d into agent-model-results Apr 20, 2021
@attesn attesn deleted the feat/print-row branch April 20, 2021 07:46
zptro pushed a commit that referenced this pull request May 12, 2021
* Fixed seed number for population draw

Set population seed, which can be used to stabilize population draw between model runs. Using fixed number and same zone data will result same population distributions.

Notice that opposite to random module, Numpy initializes seed number along with module import. Therefore not all seeds can be set at modelsystem. However, with Python 3.6. numpy.random.choice can be replaced with random.choices and there would be no need to set two seed numbers.

* Add Zone class

Copy of #267. Zone class stores information on area and municipality membership and zone index.

* Agent accessibility calculation

* Add accessibility for each agent after adding individual dummies (car user). Get car, sustainable modes and total accessibility separately.
* Transform utils to money, same application as in #265.
* Add separate print result method for model system.  Print results without groupings, which are done in R scripts later.

* Update test_person.py

* Add Zone class

* Zone class to consider multilevel areas in parameters

New multiple area intervals from #265 seem to clash with Zone class.

* Make attribute check more explicit

Revert unintended change in syntax

* Use zone_interval methods define zone area

* Replace for loops with is_in method already available in utils.zone_interval

* Remove repeated code

* 'zones' variable created before loop, so use it in place of zone_data list

* Update docstring for logit.py

* Update docstring description and return values from 'calc_individual_mode_prob'

* Remove debug print call

* Print call added to test functionality, not meant to be permanent

* Cost coefficient calculation to separate function

* Same code used in two places in 'logit.py', so similar function created to base class

* Use area_aggregation with zone areas

* Loop over param.zone.area_aggregation so that area definition is unambiguous

* Print line feature (#282)

* Create print_line method

* Align columns better with values padded up to 12 digits
Restrict number of significant digits to 7, larger numbers as exponents

* Revert "Align columns better with values padded up to 12 digits"

This reverts commit 5fd912f.

* Add print method for person object

* Use print line method for agent data output
* Add is_car_user to agent model output data
* Write columns headers in model system

* Add person id

* Add person id to clarify structure of agent data

* Add id for test person

* Adjust printing of variables

* Add missing type for income (currently printed as NA)
* Variable age to age_group as used before

* Set person id within class

* Change person_id as class variable and increment when object is created

* Coding style issues

* Fix docstring
* Remove extra whitespace
* Remove redundant 'nr_tours' variable and use len(tours)
* Use 'try / except' in place of 'if / then' (EAFP)

* Move printed attributes to Person class

* Move attributes to Person class
* Use resultdata.print_line in model system
* Utilize same class names for printing column names and getting the variables (only one list containing definitions)

* Style issue: Condense if clause

* Optimize logsum calculation for individuals

* Remove car_access as it is not used in mal-effect-calculations
* Get sustainable accessibility from purpose vector

* Fix person attribute printing order

* Dictionary keys not necessarily in same order as list

* Style updates

* Class variable with lowercase (not constant)
* Calling str function

Co-authored-by: Jens West <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants