Laboratory#
Management of a group of people and their publications is made with the LabMap abstract class.
LabMaps#
- class gismap.lab.labmap.LabMap(name=None, dbs=None)[source]#
Abstract class for labs.
Actual Lab classes can be created by implementing the _author_iterator method.
Labs can be saved with the dump method and loaded with the load method.
- Parameters:
- publication_selectors#
Publication filter. Default: less than 10 authors, not an editorial, at least two words in the title.
- Type:
- add_publication(title, authors, **kwargs)[source]#
Add a manual publication to the lab.
Author names given as strings are resolved to known authors from the lab’s publications using fuzzy matching. Unmatched names become
Outsiderinstances.
- del_publication(query, confirm=True, **kwargs)[source]#
Remove publications matching a query from the lab.
- Parameters:
query (
strorcallable) – Passed toselect_publications().confirm (
bool, default=True) – If True, display matches and prompt for confirmation before deletion.**kwargs – Passed to
select_publications().
- expand(target=None, group='moon', desc='Moon information', **kwargs)[source]#
Expand the lab with external collaborators found in publications.
Discovers authors who co-published with lab members, ranks them by collaboration strength, and adds the top candidates.
- Parameters:
target (
int, optional) – Number of new authors to add. Defaults tolen(self.authors) // 3.group (
str, default=”moon”) – Group label assigned to new authors.desc (
str, default=”Moon information”) – Progress bar description.**kwargs – Passed to
proper_prospects().
- html(**kwargs)[source]#
Generate HTML representation of the collaboration graph.
- Parameters:
**kwargs – Passed to
make_vis().- Returns:
HTML content as a string.
- Return type:
- select_publications(query, n_range=4, length_impact=0.001, threshold=80)[source]#
Search for publications matching a query.
- Parameters:
query (
strorcallable) – If a string, matches by exact key or fuzzy title similarity. If a callable, used as a filterf(pub) -> boolon each publication.n_range (
int, default=4) – Passed tosimilarity_matrix().length_impact (
float, default=0.001) – Passed tosimilarity_matrix().threshold (
int, default=80) – Minimum similarity score (0-100) for fuzzy title matching.
- Returns:
Matching publications.
- Return type:
- show_html(**kwargs)[source]#
Display the collaboration graph in a Jupyter notebook.
- Parameters:
**kwargs – Passed to
html().- Return type:
None
- update_authors(desc='Author information')[source]#
Populate the authors attribute (
dict[str,LabAuthor]).- Return type:
None
- update_publis(desc='Publications information')[source]#
Populate the publications attribute (
dict[str,SourcedPublication]).- Return type:
None
EgoMaps#
- class gismap.lab.egomap.EgoMap(star, *args, **kwargs)[source]#
Egocentric view of a researcher’s collaboration network.
Displays the star (central researcher), their planets (direct co-authors), and optionally moons (co-authors of co-authors).
- Parameters:
Examples
>>> dang = EgoMap("The-Dang Huynh") >>> dang.build(target=20) >>> sorted( ... a.name for a in dang.authors.values() if len(a.name.split()) < 3 ... ) ['Bruno Kauffmann', 'Diego Perino', 'Dohy Hong', 'Fabien Mathieu', 'François Baccelli',...]
To add publications, one can use the
add_publication()method:>>> dang.add_publication( ... title="A new paper", ... authors=[dang.star, "Fabien Mathieu", "Alice Smith"], ... venue="Journal of Testing", ... ) >>> str(dang.select_publications(lambda p: "Testing" in p.venue)[0]) 'A new paper, by The-Dang Huynh, Fabien Mathieu, and Alice Smith. In Journal of Testing [unpublished], 2026.'
To remove publications, one can use the
del_publication()method:>>> dang.del_publication("A new paper", confirm=False) >>> dang.select_publications(lambda p: "Testing" in p.venue) []
Utilities#
Expansion#
- class gismap.lab.expansion.ProspectStrength(coauthors: int, publications: int)[source]#
Measures the interaction between an external author and a lab by counting co-authors and publications.
A (max,+) addition is handled to deal with multiple keys.
Examples
>>> a1 = ProspectStrength(3, 5) >>> a2 = ProspectStrength(2, 10) >>> a1 > a2 True >>> a1 + a2 ProspectStrength(coauthors=3, publications=15)
- gismap.lab.expansion.count_prospect_entries(lab)[source]#
Associate to external coauthors (prospects) their lab strength.
- Parameters:
lab (
LabMap) – Reference lab.- Returns:
Lab strengths.
- Return type:
dictofstrtoProspectStrength
- gismap.lab.expansion.proper_prospects(lab, length_impact=0.05, threshold=80, n_range=4, max_new=None, trim=True)[source]#
Find and rank external collaborators for potential lab expansion.
Identifies authors from publications who are not already lab members, groups them by name similarity, and ranks by collaboration strength.
- Parameters:
lab (
LabMap) – Reference lab.length_impact (
float, default=0.05) – Length impact for name similarity matching.threshold (
int, default=80) – Similarity threshold for grouping authors.n_range (
int, default=4) – N-gram range for name comparison.max_new (
int, optional) – Maximum number of new authors to return.trim (
bool, default=True) – If True, keep only one source per database for each author.
- Returns:
New authors ranked by collaboration strength (descending).
- Return type:
- gismap.lab.expansion.trim_sources(author)[source]#
Inplace reduction of sources, keeping one unique source per db.
- Parameters:
author (
SourcedAuthor) – An author.- Return type:
None
Filters#
- gismap.lab.filters.author_taboo_filter(w=None)[source]#
- Parameters:
w (
list, optional) – List of words to filter.- Returns:
Filter function on authors.
- Return type:
Callable
- gismap.lab.filters.publication_oneword_filter(n_min=2)[source]#
- Parameters:
n_min (int, default=2) – Minimum number of words required in the title.
- Returns:
Filter on number of words required in the title.
- Return type:
callable
- gismap.lab.filters.publication_size_filter(n_max=9)[source]#
- Parameters:
n_max (int, default=9) – Maximum number of co-authors allowed.
- Returns:
Filter on number of co-authors.
- Return type:
callable